Enable xaxis/yaw mouse movement for mounted player

Scripts and code that enhance the gameplay functionality of the engine.
2 posts Page 1 of 1
Mack
Posts: 8
Joined: Sat Aug 19, 2017 12:55 am
by Mack » 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:
   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);
   }
Duion
Posts: 1387
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Mon Dec 31, 2018 11:33 am
You should consider adding this to the main repo, so not everyone has to bother implementing his own changes.
2 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 11 guests