4 Replies Latest reply on Jul 18, 2010 4:21 PM by 843799

    Creating realistic motion

      Does anyone know of a way of creating the realistic motion of an object? Say I have a sphere in my scene and I apply a positionInterpolator to it so that it rises and falls is there any way I can make it decellerate and accelerate according to the law gravity as it would naturally?

      If it were possible to apply different increasing alpha ramp durations to the Alpha object it may be possible, but this is not the case.

      Any suggestions would be much appreciated,

        • 1. Re: Creating realistic motion

          Use a TransformInterpolator and override the computeTransform() method with something that resembles real world physics. For example:

          class MyInterp extends TransformInterpolator {

          public void computeTransform(float alphaValue, Transform3D transform)
          //Perform physics based math to input alpha
          float interpVal = physicsMath(alphaValue);


          private float physicsMath(float val)
          //Standard cubic function on [0 1]
          return ((-2f * val) + 3) * val * val;

          The above interpolator should (I've not debugged it) start with your object at rest, accelerate it to it's top speed when alpha is at .5, and slow it to a stop again at alpha = 1. The key here is to override physicsMath() with whatever physics function best represents the behaviour you want to model. It helps to think that the alpha will change at a constant rate from 0 to 1 and that your math must mould this into something with the slow downs and speed ups you need.

          You could also avoid Alphas all together and implement animation in a seperate thread. That's what I do.

          Mark McKay
          • 2. Re: Creating realistic motion
            Thank you very much Mark, you were spot on.

            Duke Dollars coming your way.

            • 3. Re: Creating realistic motion
              hello....i have to develop prototype of simple dynamic animation system using java3d for my project. I am pretty new to java3d. till now in few days i hav been able to translate n rotate a sphere. but now m trying to apply principles of physics dynamics to simulate the sphere so tht it can show realistic behaviour..In other words i want to apply force to the sphere manually thru user interaction and want the sphere ball to move according to the laws of physics... can anyone help me in this regard...how can i achieve this...Is this possible by using ode solvers...if anyone has any sort of solution plz reply...it wud realy help me to move ahead in my project....thnks....
              • 4. Re: Creating realistic motion
                I have been working on an application like that for relativistic physics. It also does Newtonian physics and might be of interest to you. The user can insert any number of different shapes into the scene, change their dimensions and rotations, give them differen locations and velocities, switch reference frames and watch what happens. It does not yet do acceleration or forces. Things don't bounce off each other yet.

                If you have a decent PC you can run it as an applet:
                The following html page gives instructions for a simple Relativity problem but, if you check the box marked "Newtonian", it will run in Newtonian physics.


                The code is quite complicated since everything must do either Newtonian or Relativistic physics. I am willing to share it with you, but I don't know that you will be able to make any sense of it.