I’m having trouble moving the character forward whilst maintaining his current direction.

I’m setting the player’s rotation to be that of the platform in front which works as expected, however, he will turn to face the platform’s forward direction.

I got it partially working using Quaternion.FromToRotation but it makes him stand right-angled to the platform instead of standing on the correct angle.

Any ideas?

I’ve almost figured it out. If the platform is rotated side on, I’m not sure how to figure out if he needs to turn left or right.

```
targetRotation = nearest.transform.rotation;
// Set the rotation to the target & project a point using the new forward.
Quaternion rot = transform.rotation;
transform.rotation = targetRotation;
p = transform.position + transform.forward;
// Get the direction to turn to & restore rotation.
Quaternion r = Quaternion.FromToRotation(transform.forward, transform.right);
Quaternion l = Quaternion.FromToRotation(transform.forward, -transform.right);
transform.rotation = rot;
// Use the dot product to determine if the projected position is behind the current position.
Vector3 dir = p - transform.position;
float dot = Vector3.Dot(transform.forward, dir);
dot = Mathf.Round(dot);
// 1 = in front, 0 = side on, -1 = behind.
if (dot == 0)
{
// Project a point from the nearest's right.
p = nearest.Position + nearest.transform.right;
dir = p - transform.position;
dot = Vector3.Dot(transform.forward, dir);
dot = Mathf.Round(dot);
if (dot > 1)
{
targetRotation = r * targetRotation;
}
else
{
targetRotation = l * targetRotation;
}
}
else if (dot == -1)
{
targetRotation = q * targetRotation;
targetRotation = q * targetRotation;
}
```