Enable xaxis/yaw mouse movement for mounted player
Posted: Mon Dec 31, 2018 7:51 am
This topic is in response to this Job Board posting.
Thanks to @ JeffR for the assistance.
These source code changes will enable xaxis/yaw mouse movement (look left/right/turn around) for mounted players. Previously the player was restricted to only yaxis/pitch (look up/down) movement.
In PLAYER.CPP under Player::setPosition
Replace the default isMounted code with the following:
In PLAYER.CPP under Player::setRenderPosition
Replace the default isMounted code with the following:
In SHAPEBASE.CPP under ShapeBase::advanceTime
Comment out the following:
Thanks to @ JeffR for the assistance.
These source code changes will enable xaxis/yaw mouse movement (look left/right/turn around) for mounted players. Previously the player was restricted to only yaxis/pitch (look up/down) movement.
In PLAYER.CPP under Player::setPosition
Replace the default isMounted code with the following:
if (isMounted()) { // Use transform from mounted object - Thanks to Jeff Raab MatrixF zrot; mMount.object->getMountTransform( mMount.node, mMount.xfm, &mat ); zrot.set(EulerF(0.0f, 0.0f, rot.z)); mat.mul(zrot); }
In PLAYER.CPP under Player::setRenderPosition
Replace the default isMounted code with the following:
if (isMounted()) { // Use transform from mounted object - Thanks to Jeff Raab MatrixF zrot; mMount.object->getRenderMountTransform( dt, mMount.node, mMount.xfm, &mat ); bool isSer = isServerObject(); S32 id = getId(); zrot.set(EulerF(0.0f, 0.0f, rot.z)); mat.mul(zrot); }
In SHAPEBASE.CPP under ShapeBase::advanceTime
Comment out the following:
if (isMounted()) { //Standard Torque 3.9 code, commented out to fix jitter bug when enabling full mouse movement when mounted, thanks to Jeff Raab MatrixF mat; mMount.object->getRenderMountTransform( 0.0f, mMount.node, mMount.xfm, &mat ); Parent::setRenderTransform(mat); }