[SOLVED] Get global location/translation of child object after rotating a parent joint

I am rotating a rigged characters arm joint with “setLocalRotation”. I would like to get the new location/translation of the hand in space after rotating the arm joint.

I tried using “getLocalTranslation” like:

Spatial hand = (Spatial) rig.getChild("RightHand");
Vector3f handPos = hand.getLocalTranslation();

But I just get X = 0, Y = 0, & Z = 0.

I guess its because its the local translation and not the global?

Can you help me? :slight_smile:

1 Like

You are right. With getLocalTranslation() you get the local translation (the translation, that affects this node and all its children). If you want to have the global translation of a spatial, call the getWorldTranslation() method instead :wink:

Edit:
For additional information, visit the Spatial Javadoc.

2 Likes

Of course… That works :laughing: Thanks!

3 Likes