3D object animation in ROOT 5.18

Hello,

I’ve started to build a simple 3D model of a mobile I’m designing and would like to simulate harmonic motion in the arms of the mobile and view it in OpenGL. I can rotate the object with the mouse and trackpad, but would like to animate the arms themselves rather than the entire object.

I’ve looked through the OpenGL tutorials included with ROOT and can’t seem to find anything similar to my problem. I did find a similar question on this forum (root.cern.ch/phpBB2/viewtopic.php?p=17431#17431) but I have been unable to reproduce the animation. The topic refers to an older version of ROOT and I’m wondering if there is something in the newer releases of ROOT that might help me accomplish my animation.

I’ve attached the macro that creates and positions primitives using TGeoManager and TGeoVolume.

I’m running ROOT 5.18/00 on Mac OS X Leopard (10.5.2).

I’d appreciate any recommendations or tutorials anyone may suggest.

Thanks,
Nate
renderMobile.C (4.38 KB)

see $ROOTSYS/tutorials/gl/glViewerExercise.C

Rene

Hello,

Thank you for your reply. I now have camera animation working but I’m still unable to figure out how to rotate the individual objects.

I’m attempting to rotate three arms of the mobile individually. With the timer now figured out I believe that I can animate the model correctly if I knew how to set the rotation/position of a specific TGeoVolume in my code. I’ve tried “rotate()” as suggested in the animation.C macro posted on another thread. (root.cern.ch/phpBB2/viewtopic.php?p=17431#17431)

How do I “tell” a specific object to rotate and nest the objects that are to move along with it? Am I going about this the wrong way? Is there an easier method?

I’ve attached a figure of my model design to help make my description make sense.

Again, thanks in advance.
Nate


Hi Nate,

Hmm… TGeo classes are suiatble for decribing static geometry models, where pieces stick to their original positions (like detector geometries). Yes, there are handles to change object matrices on individual basis (for alignment purposes), but generally in this model several different pieces are represented by a single logical volume (to be able to represent millions of components). One may imagine doing tricks at GL viewer level, but normally TGeo structures are mapped to GL ones once (not updated unless a complete scene rebuild requested by TGeoPainter class).

Not quite helpful for your problem I guess…

Regards,

Hi,

I’ve modified your macro renderMobile.C a little:

  1. Introduce more hierarchy (displays are attached to the bars now). This is the way to attach together the objects you want to move/rotate together.

  2. Added simple animate() function that rotates one of the bars; you still have to call it by hand.

  3. Wrapped the geometry into TEveGeoTopNode object so that one gets gui control over displayed geometry (under “Geometry Scene” in object browser).

Let me know how this goes for you.

Best,
Matevz
renderMobile.C (5.1 KB)

This is most helpful. Thank you for your help!

Nate