PDA

View Full Version : Simple Animation

gottijay
07-22-2011, 01:31 AM
I am trying to make a simple animation, where i could show my models assembling each other.ie i draw the first model translate it from its original position to a certain position at that point i would draw the second model and translate it to the position of the first model to connect them and basically do the rest for the remaining models.....and at the same time rotating the camera...i cant seem to find any good tutorials ...could anyone please give me an idea how i could tackle this problem...short snippet would be helpful

thank you.

Linsnos
07-24-2011, 02:38 PM
Hi!

Since the concept of a camera is used, you can separate the problem of the object positions from the problem of camera position, i.e the position of objects is not related to the camera position.
This is done by using several coordinate systems and, with the help of matrices, transformation of points between them. You can read basic tutorials about that (local/object, model and view coordinate systems).

As for assembling objects scattered, you could make time a parameter controlling a perturbation (disturbance) in position, through a linear interpolation.
Example:
x_pos = 1.0 + 10.0*(1-t),
where 10.0 is the size of the initial perturbation, and 1.0 is the final position, reached at t=1 (where the perturbation has reached the value 0).

If you want to assemble parts (primitives) of a single mesh you could also use the geometry shader with a scaling uniform, much in the same spirit as my simple example.

I hope this helps! Good luck!