- Home /
How to get current Camera coordinates in a script
Hi,
I'm writing a log file that I want to use to record the time as well as the current camera coordinates (X, Y, Z) you can see in Inspector as well as rotation coordinates. Because the camera is attached to a First Person Controller script this would allow me to record all character movement. What are the functions to access this data? Thanks!!
I think I need to use [camera?].transform.position.x, right? But how do I initiate the camera object?
Your scene should have something called "$$anonymous$$ain Camera" by default. Camera.main will give you a reference to this.
That is exactly the reference page I linked in my answer? WHY DIDN'T YOU LI$$anonymous$$E $$anonymous$$Y ANSWER!?
The shame.
@flaviusxvii Because you didn't spoonfeed it to him/her.
Your answer
Follow this Question
Related Questions
Object coordinates relative to camera 2 Answers
UI Text position not as shown in scene view? 1 Answer
Align TextMesh on Top Right 1 Answer
When switching camera position... 1 Answer