Mouselook is really...odd.
BlitzMax Forums/MiniB3D Module/Mouselook is really...odd.
| ||
I'm not sure why but when I read the mousexspeed and then do a movemouse to the center of the screen, I can't get a reading from mousexspeed that accurate in minib3d. Everything is fine until I do a yaw = yaw - mxspd. Then yaw = -400. I must be missing something. For instance: [code] mxspd:Float = MouseXSpeed() movemouse 400,300 yaw:float :- mxspd rotateentity camera,0,yaw,0 [code] The above code doesn't work and just sits at 400. Anyone wanna take a stab at this? |
| ||
Honestly, try this...it's very irritating... yaw = - 400 I can't see why unless MouseXSpeed() is bugged and returning the position of MouseX(). 'mouselook mxspd:Float = MouseXSpeed() MoveMouse 400,300 yaw:Float = yaw - mxspd RotateEntity camera,0,yaw,0 |
| ||
Ok FINALLY... This is working: 'mouselook mxspd:Float = MouseXSpeed2() / 15.0 myspd:Float = MouseYSpeed2() / 15.0 If mxspd <> 0 Or myspd <> 0 Then MoveMouse 400,300 lastMX = MouseX() lastMY = MouseY() EndIf yaw:Float :- mxspd pitch:Float :+ myspd RotateEntity camera,pitch,yaw,0 |
| ||
I still had to use a custom MouseXSpeed because the built in keeps returning the mouse position. Getting better: 'mouselook mxspd:Float = MouseXSpeed2() / 10.0 myspd:Float = MouseYSpeed2() / 10.0 If mxspd <> 0 Or myspd <> 0 Then MoveMouse 400,300 lastMX = MouseX() lastMY = MouseY() EndIf yaw:Float :- mxspd pitch:Float :+ myspd If pitch => 89 Then pitch = 89 If pitch =< -89 Then pitch = -89 yaw2:Float :+ ((yaw - yaw2) * 20.0) * dt pitch2:Float :+ ((pitch - pitch2) * 20.0) * dt RotateEntity camera,pitch2,yaw2,0 Function MouseXSpeed2:Int() Local mxcur:Int = MouseX() - lastMX lastMX = MouseX() Return mxcur End Function Function MouseYSpeed2:Int() Local mycur:Int = MouseY() - lastMY lastMY = MouseY() Return mycur End Function |
| ||
I haven't used MiniB3D much obviously. But I can't get smooth movement like in Blitz3D. Even with smoothing, the mouselook has a slight awkwardness to it. Anyone able to get really smooth movement in this? |
| ||
Looks like Graphics3D 1024,768,32,1 doesn't set the graphics mode to the default monitor refresh. Mine's set to 85 and it's defaulting to 60. Running fullscreen is taking away the slight choppiness. Still making progress. |
| ||
Apparently there's some sort of flush thing going on with MouseXSpeed. This is working quite well: 'MouseLook BMax mxs:Float = MouseXSpeed() / 15.0 mys:Float = MouseYSpeed() / 15.0 If mxs <> 0 Or myx <> 0 MoveMouse width/2,height/2 MouseXSpeed() ' flush MouseYSpeed() ' flush EndIf yaw:Float :- mxs pit:Float :+ mys yaw2:Float :+ ((yaw - yaw2) * 25.0) * dt pit2:Float :+ ((pit - pit2) * 25.0) * dt RotateEntity camera,pit2,yaw2,0 |
| ||
Yep all graphics are defaulting to 60 hertz. Anyone know how to set the hertz in MiniB3D? |
| ||
wow a only croma thread |
| ||
Hey, no posting in my thread! =p |
| ||
Ahhh....there's an EXTRA argument in Graphics3d! |
| ||
What would be cool is to detect the current hertz of the desktop and default to that. |
| ||
Wa la. On average I'm getting about 600 more fps than Blitz3D with the 200 cubes. I'm impressed.'BMax MiniB3D MouseLook 'by Chroma Strict Import "MiniB3D.bmx" Local width:Int = 1024, height:Int = 768 Graphics3D width,height,32,1,85 Global camera:TCamera = createcamera() CameraRange camera,1,5000 Local light:TLight = CreateLight() ' FPS Init Local old_ms=MilliSecs() Local renders Local fps ' Delta Time Init Global dt:Float,NewTime:Int,OldTime:Int,TotalTime:Float=0 NewTime = MilliSecs() OldTime = NewTime ' cubes For Local n:Int = 1 To 200 Local hhh:TMesh = CreateCube() EntityColor hhh,Rand(0,255),Rand(0,255),Rand(0,255) ScaleEntity hhh, Rand(1,50),Rand(1,50),Rand(1,50) PositionEntity hhh, Rand(-1000,1000),Rand(-1000,1000),Rand(-1000,1000) Next ' MouseLook Init Local yaw:Float, pit:Float, yaw2:Float, pit2:Float HideMouse MoveMouse width/2,height/2 TBlitz2D.MouseXSpeed() TBlitz2D.MouseYSpeed() Local mspd:Float = 14.0 Local msmo:Float = 22.0 ' *** MAIN LOOP *** While Not KeyHit(KEY_ESCAPE) Cls 'Update Delta Time Delta_Time() 'MouseLook BMax Local mxs:Float = TBlitz2D.MouseXSpeed() / mspd Local mys:Float = TBlitz2D.MouseYSpeed() / mspd If mxs <> 0 Or mys <> 0 MoveMouse width/2,height/2 TBlitz2D.MouseXSpeed() TBlitz2D.MouseYSpeed() EndIf yaw :- mxs pit :+ mys yaw2 :+ ((yaw - yaw2) * msmo) * dt pit2 :+ ((pit - pit2) * msmo) * dt RotateEntity camera,pit2,yaw2,0 ' ** Update 3D ** RenderWorld ' FPS renders :+ 1 If MilliSecs()-old_ms>=1000 old_ms=MilliSecs() fps=renders renders=0 EndIf Text 0,0,"FPS: "+String(fps) Flip 0 Wend EndGraphics End Function Delta_Time() NewTime = MilliSecs() dt = Float (NewTime - OldTime)/1000.0 OldTime = NewTime TotalTime = TotalTime + dt End Function |