- Home /
Turrets |Aiming don't work
public Transform Target; public Transform Printer; //the turret public Quaternion RotLook;
void OnTriggerStay2D(Collider2D collision)
{
RotLook = Quaternion.LookRotation(Target.position);
Vector3 rotation = RotLook.eulerAngles;
Printer.rotation = Quaternion.Euler(0f, 0f, rotation.z);
}
Comment
Answer by ray2yar · Dec 28, 2018 at 04:49 PM
You might need to use: RotLook = Quaternion.LookRotation(Target.position - printer.position)
Also, this would result in the forward vector pointing towards the target. So you'll want to make sure you are keeping the correct axis in your angle. You might need to keep x and y but not z. Depends on your situation.
Your answer
Follow this Question
Related Questions
AI Turret Aiming 2 Answers
Autoaiming Turret Cannon? 3 Answers
Using iTween's Turret Example on 2D environment 1 Answer
How to make a turret focus on a point? 1 Answer
Bone lookat do not work Help! 1 Answer