# unity3d - Object keeps falling down

I have an object that moves towards another object using this line :

transform.position = Vector3.MoveTowards(transform.position, target.transform.position, speed * Time.deltaTime);


this is it's attributes:

It doesn't use gravity, kinematic and it's Y position is frozen, but it keeps falling to the floor and colliding with it. How do prevent that and keep it floating ?

• Doesn't make sense that it should fall given your configuration. Are you sure it's the correct object? Could it be that the object has a parent object that also has a rigidbody, and that one does use gravity? Also, where is the target's position? Do you actually see it moving towards the target at all, or just falling down? – tbkn23 Apr 26 '15 at 8:15

transform.position = Vector3.MoveTowards(transform.position, target.transform.position, speed * Time.deltaTime);

You do know that if the target's position is on the ground, then your object's position will also try to match the objects's Y position. You can try to make an object and check all the constraints, and it will still work if you give it a Translate script, because scripts tend to override constraints.
If you want to make your object go to the target, but still keep his Y position, you could just make a new target vector :
new Vector3(target.transform.position.x, this.transform.position.y, target.transform.position.z);

and make this the target, so your objects keeps his Y position since he's already in it, and translates on the XZ-plane instead.