Guided missile help c#

Basically im trying to make a physics based guided missile script, so far i have this:

public Transform target;
public float force = 0.5f;
private bool ifTarget = false;

public void SetTarget(Transform helTarg){
	target = helTarg;
	ifTarget = true;
}

void Update () {
	
	if(ifTarget){
		
		rigidbody.AddForce(transform.up * 100);

		Vector3 targetDelta = target.position - transform.position;
		
		//get the angle between transform.forward and target delta
		float angleDiff = Vector3.Angle(transform.forward, targetDelta);
                           
		// get its cross product, which is the axis of rotation to
		// get from one vector to the other
		Vector3 cross = Vector3.Cross(transform.forward, targetDelta);
 
		// apply torque along that axis according to the magnitude of the angle.
		rigidbody.AddTorque(cross * angleDiff * force);
		
	}
}

But this only causes weird behaviour with the missile, as seen here:
{{title}} (Target a tank with Tab and Press F for HellFire missiles, then click)

How would you go about a proper or a simple way to do this type of thing, also how would you make it go towards a target without using addForce, as that increases the speed at the same time.

What to use will partly depend on your functionality. For example, I’d pick a different solution depending on whether you want to allow the missile to miss the target or not. For a non-miss you can use:

transform.position = Vector3.MoveTowards(transform.position, target.position, speed * Time.deltaTime);
transform.LookAt(target.position);

If you want to use a Rigidbody, I’d try this first:

  • Make sure your missile is constructed so that the nose of the missile is pointed to forward. That is, when the rotation is (0,0,0), the nose should be looking at positive ‘Z’.
  • In the inspector increase the Drag significantly.

Then try something like the following (executed in FixedUpdate()):

rigidbody.AddForce((target.position - transform.position)*amount);
transform.rotation = Quaternion.LookRotation(rigidbody.velocity);

Depending on the setting of ‘Drag’, this will act fairly realistically if the target is moved. Here is an alternate couple of lines that makes the game object perfectly track the target:

rigidbody.velocity = ((target.position - transform.position) * speed);
transform.LookAt(target.position);