- Home /
Question by
Kontros · Jul 19, 2015 at 06:11 AM ·
camerarotationfirstpersoncontroller
Change rotation (y value) of the FirstPersonPlayerController
Instead of invisible walls i wanted to teleport the player back to a specific point on the map.
So I created a wall as a trigger and added a script:
public class Teleport : MonoBehaviour {
public Transform destination;
void OnTriggerEnter(Collider other) {
GameObject.FindGameObjectWithTag("Player").transform.position = destination.position;
GameObject.FindGameObjectWithTag ("Player").transform.eulerAngles = transform.rotation;
}
}
The problem is: the camera rotation doesn't change. After the teleport i keep looking in the same direction as before.
How can i change the camera rotation to a specific y-value?
Comment
Answer by mconradie · Jul 19, 2015 at 11:09 AM
Try this:
Camera.main.transform.rotation = Quaternion.Euler(x,y,z);
Where x,y,z are the new values you want for rotation
Your answer
![](https://koobas.hobune.stream/wayback/20220611231756im_/https://answers.unity.com/themes/thub/images/avi.jpg)