I am using the First Person Controller script from Unity.
If i jump on a platform i use this script to hold the character on a platform, so he is moving with it:
The problem with that is… i also get the same rotation of that object(platform) and this makes the problem. If i jump on it or from it away. I get a whole different rotation on my character and it makes it unplayable.
To rotate the platform i use this script, both scripts are on the rotating platform:
float y;
public float speedY;
void FixedUpdate ()
{
y += Time.deltaTime * speedY;
transform.rotation = Quaternion.Euler(0,y,0);
}
As @hexagonius said, use OntriggerEnter to store original player rotation and OnTriggerExit to restore it. But, to set the parente, use method .SetParent of the transform. It has a second parameter that lets you to keep original world position/rotation/scale while parenting…