- Home /
Question by
unitron · Aug 19, 2011 at 09:53 AM ·
camerafirst-person-controller
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!
Comment
Answer by KingSharaman · Aug 19, 2011 at 10:26 AM
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);