hi.
i’m using two GameObjects with SpriteRenderer, and i need that the first GameObject Look at the second GameObject. i tried using “TransForm.Lookat” but it only works in 3D mode.
hi.
i’m using two GameObjects with SpriteRenderer, and i need that the first GameObject Look at the second GameObject. i tried using “TransForm.Lookat” but it only works in 3D mode.
What does LookAt mean in context to your project? Are you making a top-down or platform style? What is the “desired” effect you wish to accomplish?
i’m doing a platform game. I have rocket and a target (both are GameObjects), and i need that the rocket sight the target
i finally solved it:
public static Quaternion lookat(Vector3 from, Vector3 target, Vector3 forwardDirection){
return Quaternion.FromToRotation(forwardDirection, target - from);
}
from and target are position points, and forwardDirection is the forward vector relative to the “from” point.