Real Time Physics Experiment #1
I've been watching people doing some nice stuff like this before, and that's pretty awesome because nowdays there is not the "perferct" system to make dynamics in such a way that it becomes animator friendly , easy to setup and with an efficient feedback system. I'm not trying to do the "perfect" system but at least try to do a better job than using reactor, spring controllers or another dynamics max- tool that currently exists.
I am using Verlet integrals to do this stuff, if you are interested about this cool mathematical stuff (i am wearing my geek eyeglasses now) you can check the wikipedia info about that: http://en.wikipedia.org/wiki/Verlet_integration. the basic idea is explained there. But in order to add more features you should research more or use some programmer imagination. anyway the concept is pretty simple:
I am using Verlet integrals to do this stuff, if you are interested about this cool mathematical stuff (i am wearing my geek eyeglasses now) you can check the wikipedia info about that: http://en.wikipedia.org/wiki/Verlet_integration. the basic idea is explained there. But in order to add more features you should research more or use some programmer imagination. anyway the concept is pretty simple:
In English words it says: the position value (it can be in 2D or 3D) in the current time is equivalent to the previous calculated position value plus the velocity that the object had before multiplied by delta time (the diference of times between the calculations), plus half of the force affecting the object multiplied by the square of delta time. The force value can be a summatory of all the forces affecting the object (like gravity or wind), the previous position value can be stored in a variable, a track or controller and the delta time can be calculated using the current time and the time registered in the previous calculation.
The object could have some constraints as well, like a specific distance that it has to be in respect to other object, or colision detection. In order to aply any constraint, the current position value has to be calculated, and then, this value has to be modified to satisfy the constraint, like bringing closer or further the objects to having them in a specific distance.
the value of the current velocity has to be calculated and stored in order to be used in the next calculation. Wikipedia suggest the use of this equation:
The object could have some constraints as well, like a specific distance that it has to be in respect to other object, or colision detection. In order to aply any constraint, the current position value has to be calculated, and then, this value has to be modified to satisfy the constraint, like bringing closer or further the objects to having them in a specific distance.
the value of the current velocity has to be calculated and stored in order to be used in the next calculation. Wikipedia suggest the use of this equation:
But the problem with this ecuation is that it doesn't consider the use of constraints, instead, i used another method to get the velocity value:
v(t+deltaT) = (x(t+deltaT)-x(t))/deltaT
the current velocity is equivalent to the current position minus the previous position all over delta time. But having in mind that the current position has the value generated by the constraints used, if delta time is zero the velocity doesn't change.
Here is what i've got so far:
v(t+deltaT) = (x(t+deltaT)-x(t))/deltaT
the current velocity is equivalent to the current position minus the previous position all over delta time. But having in mind that the current position has the value generated by the constraints used, if delta time is zero the velocity doesn't change.
Here is what i've got so far: