How do i make empty/cube follow a sphere?

hi, i have a game that involves a moving ball, and for some special effects to work i need an empty or a cube to follow the ball without rotating. ive tried a few ways, when i use a rigid body on the cube, it falls through the floor.
ive tried small scripts to lock rotation on the cube however that causes my ball to roll in strange ways.
any help would be great

Atach this script to your empty GameObject or Cube. In the inspector, drag and drop your sphere gameobject in the script.

If there is a Box Collider on the cube, be sure to check “IsTrigger” and if there is a rigidbody, be sure to UNCHECK “Use Gravity” and check “Is Kinematic”

var mySphere : GameObject;

function Update()

      gameObject.transform.position = mySphere.transform.position;


Couldn’t you just make it a child object of the sphere?
If a empty object with a rigidbody (no gravite and is kinematic) results in strange behaviour you could attach a script to the empty object:

void Update()
transform.rotation = new Quaternion(-transform.parent.rotation.x, - transform.parent.rotation.y, -transform.parent.rotation.z);

I don’t know if transform.rotation = -transform.parent.rotation; would also work…