Godot Version
Godot 4.4, Jolt physics backend
Question
I am trying to match the pose of a PhysicalBone3D to its corresponding bone from another identical skeleton that plays animation using physics forces. It seemed to me that the logical way to do this would be to use the AngularSpringEquilibriumPoint parameters in the physics_process of a custom Generic6DofJoint3D script, but I just simply can’t figure out exactly what coordinate space this parameter is in as there’s little to no documentation on it.
What i’m doing currently is taking the difference of the skeletal bone’s rest and its current pose:
Basis boneBBasis = animationSkeleton.GetBonePose(BoneBIndex).Basis;
Basis boneBRest = animationSkeleton.GetBoneRest(BoneBIndex).Basis;
Basis targetSpringBasis = boneBRest.Inverse() * boneBBasis;
..then passing it as a parameter as euler:
Vector3 targetSpringRot = targetSpringBasis.GetEuler();
SetParamX(Param.AngularSpringEquilibriumPoint, targetSpringRot.X);
SetParamY(Param.AngularSpringEquilibriumPoint, targetSpringRot.Y);
SetParamZ(Param.AngularSpringEquilibriumPoint, targetSpringRot.Z);
I’ve been poking at this for months and honestly just haven’t been able to figure out what the equilibrium point is supposed to be relative to or what i’m missing here in my math. This works as you would expect when the animation pose is exactly at rest (the joint motors keep the ragdoll in its reference pose), but when the bones rotate they rotate on the wrong axis, or sometimes flipped in the wrong direction. I’ve tried looking at jolts source code but everything’s so abstracted and muddied by having to interface with the engine.
Anyone have any ideas?