When a bone is marked as procedural, there is no way to get the animation controlled transform of the bone, as now it will only return that bone's current transform.
Being able to retrieve the bone's original transform would open up many possibilities such as active ragdolls, manual inverse kinematic for walking on rough terrain, physics based characters etc...
How would you like it to work?
if ( renderer.TryGetBoneTransform( "arm_upper_L", out var transform ) )
Log.Info( transform );
Log.Info( renderer.GetBoneObject( "arm_upper_L" ).Transform.Position );
These are the only ways to get a bone's transform right now, perhaps the addition of SkinnedModelRenderer.TryGetBoneAnimationTransform or some sort.
Ideally both the local and the world transform would be provided, but we only really need the local transform as the world one can get messy if we want to do a combination of procedural and animated bones.
What have you tried?
There's an ugly workaround for this but it doesn't always work, basically you create two skinned model rendererd with the same model.
One gets assigned as the "puppet", basically the ragdoll, and the other gets assigned as the "puppetter", which will be animated normally.
We hide the puppetter and copy each bone's transform over to the puppet every frame, when we want to ragdoll we stop copying the transforms and parent the puppetter to the puppet, when we want a physics based character we apply forces to the puppet's bones to follow the puppetter's instead of setting them manually.
That's inconvenient and doesn't work well in multiplayer.
Additional context
Here's how I'd use it for the examples I've given:
Active Ragdolls: I'd have a "writhing animation" with all procedural bones, and I'd then apply a torque on the bones based on their rotation distance to the animation controlled transform.
Manual Inverse Kinematic: I'd cast a ray coming from the knee down to the animation controlled foot, then do some manual IK to the local bone's transform so it can do IK without sacrificing walking animations
Physics Based Characters: Simply apply forces on each bone so that it follows the animation controlled transform, we can also disable entire sections if we want them to go limp
For?
S&Box
What can't you do?
When a bone is marked as procedural, there is no way to get the animation controlled transform of the bone, as now it will only return that bone's current transform.
Being able to retrieve the bone's original transform would open up many possibilities such as active ragdolls, manual inverse kinematic for walking on rough terrain, physics based characters etc...
How would you like it to work?
These are the only ways to get a bone's transform right now, perhaps the addition of SkinnedModelRenderer.TryGetBoneAnimationTransform or some sort. Ideally both the local and the world transform would be provided, but we only really need the local transform as the world one can get messy if we want to do a combination of procedural and animated bones.
What have you tried?
There's an ugly workaround for this but it doesn't always work, basically you create two skinned model rendererd with the same model. One gets assigned as the "puppet", basically the ragdoll, and the other gets assigned as the "puppetter", which will be animated normally. We hide the puppetter and copy each bone's transform over to the puppet every frame, when we want to ragdoll we stop copying the transforms and parent the puppetter to the puppet, when we want a physics based character we apply forces to the puppet's bones to follow the puppetter's instead of setting them manually.
That's inconvenient and doesn't work well in multiplayer.
Additional context
Here's how I'd use it for the examples I've given: