Negating the x component of forwardDir in CharacterDemo::clientMoveAndDisplay() and the x component of backward in CharacterDemo::updateCamera() appears to fix the issue. The ghost object will remain "locked" to the camera, and will properly move forward and backward along one of its axis.
Any ideas as to what the cause of this issue is (and a way to fix it that doesn't seem like a hack)?
Code: Select all
forwardDir.normalize ();
upDir.normalize ();
strafeDir.normalize ();
forwardDir.setX(-forwardDir.x()); // <-- add this
Code: Select all
//look at the vehicle
characterWorldTrans = m_ghostObject->getWorldTransform();
btVector3 up = characterWorldTrans.getBasis()[1];
btVector3 backward = -characterWorldTrans.getBasis()[2];
up.normalize ();
backward.normalize ();
backward.setX(-backward.x()); // <-- add this