Hi, I am relatively new to Unity and making a small 3D game where I want the Player-Character to be able to step onto a moving Platforms to get from one point to another. The Platforms move between two empty game objects but don’t rotate or scale. The Platform itself is an Emptry game Object with a Collider and the Script that moves and Detects the Player. It has a Child which is the Model of the Platform itself. The Player Character is Tagged as “Player”.
I have tried to move the player with the platforms using this code:
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
other.transform.parent = this.transform;
}
}
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Player"))
{
other.transform.parent = null;
}
}
I first tried it with the ThirdPersonController(Ethan) from the “Standard Assets 2018.4” Package and it worked fine. I then made my own Player-Character with Animations from Mixamo following this tutorial:
The new character gets turned into a Child of the Platform when standing in the Box collider of the Platform but only the Rotation of the Platform gets applied (which didn’t happen with the Ethan Controller and I don’t want it to happen) and no movement change at all happens.I have tried for some time now to get it working but I have had no luck so far.
I would be really happy if anyone could help me with this.