# Move a character standing on a rotating platform

I am trying to allow my player character to stand on moving and rotating platforms. I cannot parent the player to the platform, so I need to apply the platforms change in position to the player character. I have this working for moving platforms like this (simplified version for this post):

``````void FixedUpdate()
{
Vector3 movement = movementVector * Time.deltaTime;

rigidBody.MovePosition(rigidBody.position + movement)
playerRB.MovePosition(playerRB.position + movement)
}
``````

This works fine with my character controller.

I am trying to use a similar approach for rotating platforms, but things are move complicated. What I am trying to do it get the player’s position in local space on the platform, apply the rotation to the platform, determine where the player’s position has shifted to, then apply that to the player.

``````void FixedUpdate()
{
//get player's position in world space and transform it to local space on the platform
Vector3 localplayerPos = transform.InverseTransformPoint(player.position);

//rotate the platform
Quaternion deltaRotation = Quaternion.Euler(Vector3.up * rotationSpeed * Time.deltaTime);
rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);

//get movement vector by transforming the local position back to world space and subtracting that from the player's position
Vector3 movement = player.position - transform.TransformPoint(localplayerPos);

//move the player by the movement value
player.MovePosition(player.position + movement);
}
``````

When I run this code, movement vector is always 0,0,0. Anyone know what am I doing wrong? I assume it is something to do with the point transform operation, but I can’t see the error.

Note: this is only to apply the change in position, I haven’t even begun to try to calculate the change in rotation. I don’t even know where to begin with that, so if anyone can help me with that too you would be amazing

Im not sure how but you should be able to parent and unparent the player to the platform