Hairibar.Ragdoll icon indicating copy to clipboard operation
Hairibar.Ragdoll copied to clipboard

API for Ragdoll Power Profiles. Updating power settings for individual bones at runtime

Open SkyYurt opened this issue 3 years ago • 0 comments

Could you add an API for the Power Profiles so that I could change the power setting for one of the bones at runtime. A method like this should be sufficient:

void SetBoneSetting(BoneName bone, PowerSetting setting)
{
    settings[bone] = setting;
}

Additionally a component that we could attach to the ragdoll bone, that could be called and have its' power settings changed at runtime. Right now I solve this issue by using RagdollDefinitionBindings to get the BoneName and then get the RagdollBone by again using RagdollDefinitionBindings:

if (bindings.TryGetBoundBoneName(joint, out BoneName boneName)) {
    if (bindings.TryGetBone(boneName, out RagdollBone bone)) {
        bone.PowerSetting = PowerSetting.Powered;
        bone.Rigidbody.isKinematic = false;
        bone.Rigidbody.collisionDetectionMode = CollisionDetectionMode.Continuous;
    }
}

It could be awesome if we could simplify this.

SkyYurt avatar May 27 '21 17:05 SkyYurt