Getting Joint world translation Monkanim

I’m trying to manually control Joints in Monkanim, but the problem that I’m running into is that the Joint class exposes only the local transforms. Is there a way that I can access the world transform for each joint?

Ok so I was able to get the world space coordinates of the joints by accessing the translation by combining the transform with the skinning control spatial:

joint.getModelTransform().clone().combineWithParent(skinningControl.getSpatial().getLocalTransform()).getTranslation();

But what I’m running into is how do I set the local translation of the joint, especially since the local space is relative to the parent joint or root joint origin? Any thoughts @nehon ?

Could you explain what you are trying to achieve please?

1 Like

Hello, thanks so much for responding. What I’m trying to do is move joints programmatically according to the locations of spatials. The current setup I have is an oscillating sphere that moves up and down, what I currently have is a series of primitives that track the movement of the sphere:

https://streamable.com/ssbix

What I want to do is replicate that same tracking behavior with the characters arm:

The issue that comes up is how do I convert the world coordinates of the “tracking” primitives into the local translation of the armature’s joints?

Like IK? (inverse kinematics)

…that is “non trivial” ™

Currently I’m using Caliko Inverse Kinematics Library (GitHub - FedUni/caliko: The Caliko library is an implementation of the FABRIK inverse kinematics algorithm in Java.) to do the calculations. The idea is that I would take the translations (my assumption is that they are represented in world coordinates) of the bones in the IK chain and apply then to the joints for the character armature.

1 Like

Nah, you should take the rotations from the IK chain, I guess. I mean, you could probably reverse engineer the rotations from the translations… which is what you’d have to do to avoid having the mesh look like ass… but I bet the IK chain already has that since it needed to know it to do the IK. Translation is a side-effect.

Hmm good idea, I will try this out. Wish me luck!

Also, if you have a Ik lib, i’m surprised you can’t get the local transform of each bone in the chain. I mean it’s basically what I would output if I did a IK library…

Apparently it seems as if Caliko only provides the locations based on world coordinates. Now if only I can figure out the process to convert from world space to bone space or at the very least model space to bone space.

Locations are kind of meaningless. Ultimately you will need rotations or the mesh won’t know how to morph.

So not only will you need relative locations but you’ll need to figure out the rotational transforms to get those local translations.

In bone animation, translations are generally just a side effect of the rotations.