Using this function I have been able to make an object float to a destined position, how ever, should this object come to a wall or any object that has a greater mass than it, there is no proper collison and it knocks the other object away or goes right through it.
how can i tell this object not to go through others or push over others during this procedure. all object have colliders that work.
Thanks a ton!!
asked Feb 18 '10 at 03:56 PM
If you explicitly set the position of an object like that, collisions can't work. You have to make it a rigidbody and then apply forces, such as with AddForce and so on, so the physics engine can work properly.
answered Feb 18 '10 at 04:21 PM
That problem happens because explicitly setting the position overrides the Physics on the object. Like Eric said, you want to add a rigidbody and apply forces or you can even try toying with its velocity a bit.
From my comment @Eric5h5 I meant it will be no easy work if this object actually need to do anything else than "float to a destination point" like stop on it, or bring something along.
If it's just reaching it, then just use AddForce rather than the Lerp. It will throw the object and physics will do the rest. Try it, you will see. ;)
answered Feb 19 '10 at 08:53 PM