Set a custom bone pose of a skeleton in Godot 4.0

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BR14Nx

I am converting my project from 3.2.1 to 4.0.2.
Is this also somehow present in Godot 4.0 or how would one do that?
I cannot find anything to simply override the pose with another one. There are only optiosn to set the position and rotation of a pose.

:bust_in_silhouette: Reply From: zhyrin

The link you provided is weird. It says it’s the stable version, but it’s organized like the 3.5 branch of the docs. Also, the one you linked - Skeleton - does exists in 4.0 but 3D nodes have been renamed to have better parity with 2D names.
I recommend you use the english version of the docs if you’re uing 4.x.

Here is the 3D version, you can set a global transform override.
Here is the 2D version, you can set a local transform override.
It’s odd they have this idfference, I’m sure there’s a reason.

Yeah I also do not really understand the documentation links. It’s not easy to find the right branch someone might need.
And yes, I already knew there is a global transform override in 4.0. That also existed in 3.0, but is not the one I am looking for, since this is not setting a custom pose.

In the 4.0 docu:
Note that "global pose" below refers to the overall transform of the bone with respect to skeleton, so it not the actual global/world transform of the bone.

I tried to implement it before, but it didn’t do the job. The bones were twisted all wrong. Maybe there is a way to make my bone pose into a global bone pose so I can set the global override, but I have not figured it out yet.

The docu for the global override says:
The pose transform needs to be a global pose! To convert a world transform from a Node3D to a global bone pose, multiply the Transform3D.affine_inverse of the node's Node3D.global_transform by the desired world transform.
But I do not understand the math here. Is the Node3D the bone? But then I have to write down the full hierarchy path of the bone since there is no function to get the Node3D of a skeleton.
I feel like this is became all much more difficult in 4.0, so that’s why I asked.

BR14Nx | 2023-05-16 11:40