As the title says, I’m trying to get a cube to float in front of the player (cube is a placeholder until i can get the scripts working properly)
However, what keeps happening is that the cube flys into the character and then circles around the central point of the player - is there a way to get it to go within a certain radius of the player and then just float around in front of them?
Heres what I’m using at the moment:
var target : Transform;
var moveSpeed = 20;
var rotationSpeed = 5;
var myTransform : Transform;
function Awake() { myTransform = transform; }
function Start() {
target = GameObject.FindWithTag("Player").transform;
}
function Update () {
myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
Any advice would be greatly appreciated as my programming skills aren’t exactly top notch!
thanks in advance, Cobaas