mouselook troubles
Blitz3D Forums/Blitz3D Beginners Area/mouselook troubles
| ||
ok, heres the problem ;mouselook------------ PositionEntity pivot,EntityX(pivot),y#,EntityZ(pivot) RotateEntity pivot, EntityPitch(pivot) + MouseYSpeed ()/2, EntityYaw(pivot) - MouseXSpeed(), 0 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 ;--------------------- when i use this code along with moving forward i move up (my Y increases).. how do i stop that?? and yes i have gravity set ;gravity ------------------ If Not EntityCollided(pivot,SCENERY) TranslateEntity pivot,0,-0.2,0 End If ;----------------------------------- |
| ||
i got it .. mouselook-------------------------------------------------------- RotateEntity camera,EntityPitch(camera)+MouseYSpeed()/2,0,0 RotateEntity pivot,0,EntityYaw(pivot)-MouseXSpeed()/2,0 MoveMouse GraphicsWidth()/2,GraphicsHeight()/2 --------------------------------------------------------------------- |
| ||
I use 1 pivot to represent the players feet and only apply yaw to this pivot. The camera is parented to this pivot and only pitch is applied to the camera for looking up and down. When the player moves forward it is the 'feet' pivot that is moved, the camera will follow because of the parenting but the camera's pitch will not make the player move up and down. [Edit] yes thats it...you sneaked the second post in before me ;) You can also now have a variable which describes how high above the feet pivot the camera is and when the player crouches or stands up, move the camera nearer or farther away from the feet pivot to simulate this. Also when the player is moving up/down stairs you can modify this 'feet to camera' distance to make the camera smoothly fly on the stairs instead of bumping up/down at each step. |
| ||
so i can simulate crouching this way?? ok,thanx Shambler |
| ||
Check this out, it has full FPS mouselook, shooting etc... - http://www.jameskett.dsl.pipex.com/Tokamak_Ragdoll.zip |