Moving an object using rigidbody.AddForce & keyboard input.

I’m making a simple top down shooter to get to grips with Unity and have hit a snag.

When the player moves within range of an enemy, the enemy should start following the player. This works using the following in FixedUpdate:

function FixedUpdate()
{

if (player)
	{
	 	distance = Vector3.Distance( player.transform.position, transform.position);
		
		if ( distance < 1.5 && distance > 0.05 ) 
		{
			var delta = player.transform.position - transform.position;
			delta.Normalize();
	
			var speed = moveSpeed * Time.deltaTime;
			print("close");
	  	
			rigidbody.MovePosition(rigidbody.position + (delta * speed));

		}
	}

}

However, It doesn’t work if I use:

rigidbody.AddForce(rigidbody.position + (delta * speed));

Furthermore, it doesn’t even work if I use:

rigidbody.AddForce(transform.forward * 10000,ForceMode.Impulse);

There’s just no movement at all when using AddForce. It’s probably something really simple but I couldn’t find an answer on the forums/online.

Has anyone encountered this before?

Most likely your rigidbody is set to be kinematic - that means it’s not affected by external forces, so AddForce() will not affect it.
Make sure that the kinematic checkbox in the rigidbody is off.
Also, AddForce() applies the force for the time of the FixedUpdate, so there’s no need to multiply it by Time.deltaTime (and even if you did, you’d want to use Time.fixedDeltaTime when you use it in FixedUpdate()).
Last, the vector you want to pass to AddForce, is in the direction of the force you want to apply, I’ll assume forward.

So the code should be:

rigidbody.AddForce(transform.forward * 100)

you can play with the number to get the accelleration you want. Keep in mind that this