- Home /
missile homing script issues
Hello guys! I use script below for making missile homing:
transform.LookAt(closest.transform);
transform.Translate(Vector3.forward*speed*1);
it works, but it change his direction not so smooth like i need it (look at the img below), is there some way to make it more smooth? Like the red arrow on the img below? Thanks in advance!
trail.jpg
(38.3 kB)
Comment
Best Answer
Answer by Chronos-L · Jan 13, 2013 at 06:23 AM
rotationSpeed = 1.0f;
movingSpeed = 2.0f;
//Smoothing Rotation
Quaternion rot = transform.rotation;
transform.lookAt(closest.transform);
transform.rotation = Quaternion.Lerp( rot, transform.rotation, rotationSpeed * Time.deltaTime );
//Smoother motion
transform.Translate(Vector3.forward * movingSpeed * Time.deltaTime);
My code from a previous project.
Your answer
![](https://koobas.hobune.stream/wayback/20220613090829im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
need help on creating this missile launching thing. 0 Answers
Homing missle with raycast 1 Answer
Move missile to nearest target 1 Answer
adding script to a clone 2 Answers