Move object to position at speed.

Hey all,

Just wondering, I'm currently making an intro animation using Lerp to move the character from position to position. I was wondering if there was a better way to do this.

What I'm after is get the character to move at a constant speed but not a duration to the first point. And the other point I want the speed to ease out. Sort of like a rocket taking off.

The lerp sort of works fine for the first move but its not really ideal for the ease in.

Is there a method like lerp that allows me to do this.


You can use a self-defined variable for speed , any float. Fill it in with a value that increases by X over time (acceleration) and has a max value. You can also Include resistance or friction reducing it , or just lower it when you don't want to increase speed by default (decelleration)

Using a code construction a character controller and the Move function should have enough tools to enable such a construction, that I am fairly sure of.

Also you could make movement using the physics engine which does far more complex movements then ez-quick-fix constructions. Just have a rigidbody and start throwing the " Force " keyword into the Unity script reference and before you know it stuff is flying everywhere with all kinds of neat laws of physics such as this one for kinetic energy.

EDIT 08:52 GMT+1 12/08/2010:

A rocket sample actually exists already , you can find it here

You could use Mathf.Smoothstep on the x y and z portions of the Vector3 (there's no Vector3.Smoothstep). You can also try the Vector3.SmoothDamp function but I'm not sure if that is the effect you are going for.