@mec said:
Hi again @TwistedTwigleg ,
I hope your well,
Would you please say some more information about BoneAttachment node that your using in projects.
Sure!
I am using a custom Bone3D like node for my projects, specifically for my IK plugin Twisted IK 2. The bone setting part of the node is pretty simple, it attaches a signal to the idle_frame
or physics_frame
signal in the SceneTree, and then uses that to apply and then get the global pose transform.
There is a bit more to it for IK related stuff, like getting the bone length and correctly rotating the bone directions so forward for the bone is -Z even if the base model uses a different bone forward axis, but that’s really mostly just extras. The important parts is converting the transforms from a GlobalTransform to a GlobalPose (which I think my example had code to do?) and setting up the scene correctly so child bones nodes are correctly modified by their parent bones nodes.
What should I do for moving whole left and right arm in the same time?
The easiest solution is to recreate the bone hierarchy exactly as it is in the 3D file. For example, if you want to move the whole left arm, then you’ll want something like this as your Bone3D-like nodes:
= Shoulder_Left
== Forearm_Left
=== Lowerarm_Left
==== Hand_Left
===== Etc
= Shoulder_Right
== Forearm_Right
==== Lowerarm_Right
===== Hand_Right
====== Etc
Then you want to follow and apply the bones in the correct order. If you have it like the example scene tree setup above, then it’s normal process order should be fine, as it will do the children and then the parents as expected without any issue. The reason it has to be like this is because the global_pose_override only affects the bone it’s applied to, so child bones use the non override pose and then become detached and look visually strange.
In Godot 4.0 this won’t be totally necessary, as you can override the local pose using set_local_pose_override
, but this function isn’t in Godot 3.X and so recreating the bone hierarchy in the scene is sadly the only way to replicate the functionality where you can modify bones and have all the children bones correctly update.
Hopefully that helps and makes sense! If anything isn’t clear, do not hesitate to ask and I’ll do my best to answer when I have the time :smile: