Wednesday, March 6, 2013

preventing camera gimbal lock under multiple inheritance

 
Added inherited rotation from the rigid body to the player camera.  This way, if the player collides with level geometry at an angle, or receives impulses from enemy fire, it disrupts your aim and you must compensate in order to avoid disorientation. 
Will have to beta test those parameters to find a happy medium because I'm afraid it may be too disorienting for the casual player.  However this is core to the concept of kyuplex, and an important part of the core gameplay as well; movement in 3d space.  My roommate described it as four dimensional PacMan. 
Took me the better part of a session to figure out where and how to prevent gimbal locking the camera now that it is child to a two-parent hierarchy:

btRigidBody-->camPivot --> playerCam

Furthermore it is confusing because the playerCam inherits the camPivot's rotation through the irrlicht node but the camPivot inherits through the kxMotionState.  Once the rotation of the node is set (in the motionState) the playerCam immediately inherits that rotation, so gimbal lock must be checked just before that.  (in the motionState)




No comments:

Post a Comment