Acceleration Deceleration Tut
Xpresso – by: base80
November 7th, 2005
Here is a little tutorial about animating a car body according to its acceleration or deceleration.
Follow up:
Here we go, setup a hierarchy where the parent is called “Car” and put a “Body” in it as a child and of course a couple of wheels. I’ll talk about the wheels another time.
Drop the Car and its Body in the xpresso editor.
What we want to know is if the car is accelerating or decelerating or driving at constant speed or standing still for that matter. Every one of these states will affect the inclination of the car body.
So, we need to open the Position velocity-out-port of the car, this port provides us with the velocity in vector, that is the speed at witch the car moves.
In this case we only need the Z direction and use a Vector2Reals-node to extract the Z.
Now if you want to know when the car accelerates we need to compare this velocity with a previous velocity. Take a memory-node and set it to look one frame back. Connect the Position velocity and that memory-output to a math node set to subtract. The subtraction of these two will give 0 if the car is standing still and it will give a 0 when it drives a constant speed. It will however give a negative value when braking (-) and a positive value when accelerating (+). Great!
Connect this output to a range-mapper and connect the range mapper to the rotation P of the Body of the car.
Now you need to fiddle around with the lower and upper values coming into the range mapper and of course the upper and lower output too. I can’t predict what these values will be for every setup as it is dependent of the speed at witch things accelerate.
Here is the image of the setup.