VaygrEmpire VaygrEmpire - 1 year ago 93
C# Question

how do I make object face player?

I've been following various StackOverflow answers, and I think I found code that works, but before I put any code, I've got to figure out whether or not how Unity knows which way is the "front" of the object.


I'm trying to use above code for enemy object to face the player. When I place object into the scene, how do I let Unity know which way is the front of the object? (i.e. I place airplane object into the scene. "I" know which way is the front, but does "Unity" know which way is the front?)

Thank you for your help in advance.

Answer Source


Rotates the transform so the forward vector points at /target/'s current position.


Shorthand for writing Vector3(0, 0, 1).

Front is same as forward vector and forward vector is pointing at object Z axis.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download