Page 1 of 1

Character demo movement is incorrect

Posted: Thu Aug 02, 2012 12:57 am
by jeff
When turning in the character demo, the ghost object seems to turn one way, while the camera turns the other. Instead, the ghost object should be "locked" to the camera, so that the same side is always visible. Also, if you press "W" to enable wireframe, you'll notice that the forward/backward movement direction does not correspond to the direction of the red/green/blue axis.

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