I know this topics been covered many times. I’ve read around 50 threads on the subject but I simple can not get my missiles to track properly.
I’m making a bullet-hell style shooter in 3d, but all of my game objects are restricted in the z axis to 0, so it’s really 2d in 3d.
I am trying to implement missiles that track their target without using the apply force and rigid body manipulation.
The quaternion based solution is:
Quaternion rotation = Quaternion.LookRotation(myTransform.position-myTarget.transform.position);
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, rotation, Time.deltaTime * 5f);
Later in the function I call
myTransform.Translate(Vector3.up * amtToMove);
To move the missile.
The supporting code selects a target and draws a debug line to the target so I know my target selection is working fine. The missiles track some wonky path that is unrelated to what I am trying to accomplish.
I’m close to just hacking a vector comparison test and rotating in the proper direction but I’d love to do this the right way instead.
Code would be great but an explanation of which functions to use and why would be greatly appreciated.
**Solved -
The solution was posted by meanstreak in This thread
Many thanks.