Roll-A-Ball enemyball[Personal Extra] Cant get it to follow the player

Im building onto the roll-a-ball Project,this enemy ball is absolutly extra and isnt part of the project. My idea was to have am Enemy ball that follows you around, i have an idea of what to do when the enemy gets to you, only problem is im having trouble getting to the player, If any of you got any ideas on how to make this code the code i need to make it follow the player then post below :D.

using UnityEngine;
using System.Collections;

public class EnemyBehaviour : MonoBehaviour {

public int EnemySpeed;

private Transform Target;

void Start () {
EnemySpeed = 60;
Target = GameObject.Find ("Player");
Target = Target.transform;
}

// Update is called once per frame
void FixedUpdate () {
	transform.position=Vector3.MoveTowards(transform.position,Target.position,EnemySpeed);
}

}

This is the code for the EnemyBall objects script, i am grateful for any help that i get on this, again the objective is to make the enemyball move towards the player, its trying to touch the player so no max distance can be set either

thanks in advance

first thing’s first:

Target = GameObject.Find ("Player");
Target = Target.transform;

should be

Target = GameObject.Find ("Player").transform;

for truncation.

Secondly, DO NOT modify positions when using a rigibody unless it ABSOLUTELY what you need. In the case of moving, DON’T use the position.

Use

transform.LookAt( Target.position );
rigibody.AddForce(transform.forward, EnemySpeed);

If necessary (it should look nicer) lerp the angle.
Here’s how it’d look like:

Quaternion oldRot = transform.rotation;
transform.LookAt( Target.position );
transform.rotation = Quaternion.Slerp(oldRot, transform.rotation, 0.5f);

rigidbody.AddForce(transform.forward, EnemySpeed);

Look up how to roll a ball, since that would require using rigidbody.AddTorque and I’m not use what to give as parameters there.

using UnityEngine;
using System.Collections;

public class EnemyBehaviour : MonoBehaviour {

public int EnemySpeed;

private Transform Target;

void Start () {
	EnemySpeed = 60;
	Target = GameObject.Find("Player").transform;
	
}

// Update is called once per frame
void FixedUpdate () {
	rigidbody.AddForce(transform.forward , EnemySpeed);

}

}

still appears as though there are still errors,ill try working them out but extra help is always desired :slight_smile: