fix(TankAuthority): Player pos 1m up

This commit is contained in:
MrGadget 2024-08-09 16:48:14 -04:00
parent 2fe1b8fd38
commit 6b3f70ab51

View File

@ -111,8 +111,10 @@ void CmdReleaseControl()
// get the regular player object
if (connectionToClient.authenticationData is GameObject player)
{
// Set pos and rot to match the tank, plus 3m offset to the right
player.transform.SetPositionAndRotation(transform.position + transform.right * 3, transform.rotation);
// Set pos and rot to match the tank, plus 3m offset to the right plus 1m up
// because character controller pivot is at the center, not at the bottom.
Vector3 pos = transform.position + transform.right * 3 + Vector3.up;
player.transform.SetPositionAndRotation(pos, transform.rotation);
// set the player object back to the player
isControlled = false;