How would I Move a rigidbody towards another object?

I am developing an AI.

Before, I did not have a rigidbody attached to my object so I just said to use transform. This will no longer work because I need to use a rigidbody now.

THANKS

I suppose the first thing you’ll want to do is rotate the rigidbody towards the target, then propel it forward. That, or if you don’t want it to face the target you can simply determine the vector towards the target and propel the rigidbody along that vector.

Example for implementing the first method(all code is c#):

void FollowTargetWithRotation(Transform target, float distanceToStop, float speed)
	{
		if(Vector3.Distance(transform.position, target.position) > distanceToStop)
		{
			transform.LookAt(target);
			rigidbody.AddRelativeForce(Vector3.forward * speed, ForceMode.Force);
		}
	}

An example of implementing the second method:

void FollowTargetWitouthRotation(Transform target, float distanceToStop, float speed)
	{
		var direction = Vector3.zero;
		if(Vector3.Distance(transform.position, target.position) > distanceToStop)
		{
			direction = target.position - transform.position;
			rigidbody.AddRelativeForce(direction.normalized * speed, ForceMode.Force);
		}
	}

This is what i found:
https://forum.unity.com/threads/from-mathf-movetowards-to-rigidbody-moveposition.349882/

Anyone using this code today, use this one instead:
using UnityEngine;
using System.Collections;

public class SlimeMovement : MonoBehaviour {

	Rigidbody2D rb;

	void Start ()
	{
		rb = GetComponent<Rigidbody2D>();
	}
	
	void FollowTargetWithRotation(Transform target, float distanceToStop, float speed)
	{
		while(Vector3.Distance(transform.position, target.position) > distanceToStop)
		{
			transform.LookAt(target);
			rb.AddRelativeForce(Vector3.forward * speed, ForceMode.Force);
		}
	}
}