Jump to content

Enable xaxis/yaw mouse movement for mounted player


Recommended Posts

Posted

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);
   }

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...