Skip to main content

Centre of rotation and animation

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2010-09-20
Points: 0

I, like many others asking questions on this forum, am relitively new to Java3D, I have a couple of questions.
1. How do you set the centre of rotation of a branchgroup so that its child nodes dont rotate around the origin (0,0,0)?
I'm trying to create a simple character by loading each limb from a vrml file (.wrl) and then adding each from their respective
class to a "PlayerObject" class, and then intend to animate each limb, problem is, if I try rotating a limb it's centre of rotation seems
to be at 0,0,0 so the limb gets displaced fromt the rest of the limbs, what I'd like to do is set its CoR to a position I can specify e.g.
RightUpperArm would have a CoR at the position of the shoulder and then RightLowerArm's CoR will be at the end of the
RightUpperArm and added to it as a child...
2. The answer to this might make the above completely irrelivant, do VRML files support animation? and if so could someone point me to an example of using
an animation.
I tried saving an animation to the .wrl but the application throws some exceptons when it tries to load the file. It could be that my loader for VRMLs doesn't support animation
so anyone got a link to a good vrml or .3DS loader with examples of use.
I'm grateful for any help.
Thanks, Mal.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2011-02-14
Points: 0

I am relative new to Java 3D but i know some about 3D.
To make this simple imagen two different situations.
Lets say we are having a box.
Box b = new Box(..);
You stand in the middel of the box!
Lets say that you wont the box to move to your left and and the box itself be rotated 30 degres counterclock around the y axis of itself.
This is easy to accomplies. Use rotate and translate! But the ORDER IN WHICH YOU CALL THEM IS VERY IMPORTANT.
You should call translate first! And then rotated! Then the box will be placed to the left of you and rotated around the box itself.

Therefor in your situation you should translate the limb first and after that make the rotation.
Maybe you allready knows this. But it is worth a short
If we rotate first and then translate you will not rotate the box around itself but around you! Resulting in the the box wil be (in front/to the left) of you.