- Home /
Where is object looking
Hello
I need help , How can i determine which direction is Main Character looking ?
I need to do smt like if main character is looking on the gameobject (its in front of him)
make something how to do this ? and how to set the angle that will be taken as mainchar is looking forward
Answer by nasapc123 · Mar 20, 2012 at 12:54 AM
you can use Vector3.forward
for that. to get the forward direction of the main camera, you can use Camera.main.Vector3.forward
to obtain its forward rotation value.
Answer by PavolM · Mar 24, 2012 at 02:53 PM
thanks but can you write back and example ? i still cant imagine how can i use this ... if i have an gameobject and i want to make my character jump when he is in front of GameObj. how i write the if statement ? If( vector3.forward ... ? unity script reference dont help me too ...
sry for my english
Your answer
![](https://koobas.hobune.stream/wayback/20220613065258im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Apply force at an angle or transform.rotation 1 Answer
Need a little help with quick angle equation 2 Answers
Calculate vector3 from angle 2 Answers
Rotating A Character 180 Degress 1 Answer
Calculating a Second Set of Normals 0 Answers