Access to the Camera of a First Person Controller

Hi,

does somebody of you know, how to get access to the Camera that is attached to a First Person Controller. I’ve stored my FPC in a variable of type “GameObject” and now I want to set the angles of the Camera to zero.

Thank you!

1 Answer

1

Assuming you have added the the Firt Person Controller from Standard Assets attach the script to the First Person Controller and then you can use this (in JavaScript):

var cam = transform.Find("Main Camera").gameObject.GetComponent(Camera);

or

var cam = GameObject.Find("First Person Controller/Main Camera").GetComponent(Camera);