Rolling With It

Im Having a probleme.

a have a ball that rolls but i want to have a porjector over it at all times. but when i hit play and roll him/ the porjector rolls with him. I want the projector to stay above him.

Please Help!

Colin

On the projector:

OffsetFollow.js

var target : Transform;
var offset : Vector3;

function LateUpdate() {
  transform.position = target.position + offset;
}

Set the target to your ball object and set the offset to position the projector above it somewhere (0,5,0) perhaps

maybe try having the projector as the parent and the ball as the child?

@Vicenti

Thank You So Much! Its Working Great Now!

@JM Stuidios

I tried that. it didnt work. but thanks for posting!

You can assign the position of the ball transform to the projector transform fixed update. (ie) This is off the top of my head but i think it will work lol.

var projector_0A : Transform;
var projector_offset : float;
function FixedUpdate() {
projector_0A.transform.position.x = transform.position.x;
projector_0A.transform.position.z = transform.position.z;
projector_0A.transform.position.y = transform.position.y + projector_offset;
}