Rotate FPS controller on a platform without parenting

Hello,
I’m trying to make a little platformer game, but I’m facing some big troubles making the player to rotate with the platform it stands on. I’ve been researching in google all day and I found absolutely nothing. So the problem is this: I want to make the player rotate with the rotating platform, but without making him a child of the platform. So far I did something like this:

GameObject target = null;
Vector3 _movOffset;

 void OnTriggerStay(Collider col)
    {
        if (col.name == "_player")
        {
            target = col.gameObject;
            _movOffset = target.transform.position - transform.position;
        }
    }

private void Update()
    {
            target.transform.position = transform.position + _movOffset;
    }

This works fine for moving platforms, but unfortunately I have no idea how to make the player stay on rotating platforms, I tried with something like this:

target.transform.rotation *= transform.rotation;

but when I jump on the platform it changes my camera orientation with more than 60 degrees…
Please help, thank you in advance!

Platform is rotating, and when player stand on platform you want to rotate him like the platform is rotating?

  1. If you want rotate just player without camera then you should have camera out of player prefab that you rotate, or rotate just player mesh in prefab.

  2. You have to check if is collision with platform

  3. Platform rotation you should make in other script just for platform and there you check collision with player object and save player.

public class platform{

float speed = 10;

GameObject player;

bool isCollision = false;

oncollisionenter(){

//check if player tag

player = collider.gameobject

isCollision = true;

}

oncollisionexit(){

//check if player tag

player =null

isCollision = false;

}

update(){

transform.rotation *= …

if(player != null && isCollision)

player.transform.rotation *= …

}

Thank you for the help, but this is not what I’m looking for.
Probably I didn’t explained the problem correctly, so this is basically what I want:

  • Jump on the platform and start rotate the player with the platform as if it is a child of the platform
  • make the camera look at the same direction as it was looking before the player jumped on the platform
  • Do all this without parent or unparent any object

what I did so far is this:

     target.transform.rotation *= transform.rotation;

this code will rotate the player correctly with the platform, but it will turn the camera away
from the initial view direction