Hello Everyone iam new in this field and i am trying to make Missiles type game available on Play Store. My Question is when target dorch the missile then it should complete a circle and then follow the target. And in my code it is simply following the target Here is my code. Thanks
void FixedUpdate () {
relativePos = target.position - transform.position;
relativePos.z = 0;
Rigidbody rb = GetComponent<Rigidbody> ();
float angle = Mathf.Atan2(relativePos.y, relativePos.x) * Mathf.Rad2Deg;
Quaternion q= Quaternion.AngleAxis( angle, Vector3.forward);
transform.rotation = Quaternion.Lerp(transform.rotation, q, Time.deltaTime *speed);
rb.interpolation = RigidbodyInterpolation.Interpolate;
Vector3 thrust = (relativePos).normalized * acceleration * Time.deltaTime;
rb.velocity = rb.velocity * friction + thrust;
Quaternion temp3=transform.rotation;
temp3.x=0;
temp3.y=0;
//temp3.z = 0;
transform.rotation=temp3;