- Home /
Question by
MClion9 · Mar 17, 2018 at 12:57 PM ·
c#unity 5fpscamera rotate
Rotate camera to default position when player collides
In the game the player runs and doges obstacles. What can i do to make the players camera rotate back to the default postition (0,0,0) when he hits an oblject with the tag respawn.
This is the teleport script
void OnTriggerEnter(Collider other) { if (other.tag == "Respawn") { transform.SetPositionAndRotation (respawnpoint.transform.position, test);
Comment
If that script is on the player you are simply moving the player. If that script is in the camera, unless you have a collider in the camera OnTriggerEnter will never be called.
If you are the first case try creating a public variable for the camera, and assign the desired camera in the inspector, then use that variable to set up camera location and rotation.