I’m new to unity, and am trying to figure a way to create a revolving door, so that when my player runs into it, the door will rotate 90 degrees as the player goes forward.
I tried creating a hinge joint on the object, but when my player runs into one of the walls on the revolving door it spins on a bunch of axes. I was wonder wether the best way to do this would be using a script with OnCollisionEnter or OnTrigger or something else.
The OnTriggerEnter should work great. If you want to make it go open from a distance, you could make an if statement with a [Vector3.Distance][1] and trigger it when the distance is lower than the distance you want.
To rotate, you can simply use [Quaternion.RotateTowards][2]: