Esempio n. 1
0
        internal PowerSetting GetBoneSetting(BoneName bone)
        {
            ThrowExceptionIfNotValid();

            if (settings.TryGetValue(bone, out PowerSetting setting))
            {
                return(setting);
            }
            else
            {
                UnityEngine.Debug.LogWarning($"Requested power settings for {bone}, but no setting for it was found in {name}.");
                return(PowerSetting.Unpowered);
            }
        }
Esempio n. 2
0
        internal float GetBoneMass(BoneName bone, float totalMass)
        {
            ThrowExceptionIfNotValid();

            if (factors.TryGetValue(bone, out float factor))
            {
                float actualFactor = factor / GetTotalFactorSum();
                return(totalMass * actualFactor);
            }
            else
            {
                UnityEngine.Debug.LogWarning($"Bone \"{bone}\" is not present in {definition.name}.", this);
                return(1);
            }
        }
Esempio n. 3
0
        public bool TryGetBoundBoneName(ConfigurableJoint joint, out BoneName boneName)
        {
            ThrowExceptionIfNotInitialized();

            foreach (KeyValuePair <BoneName, ConfigurableJoint> pair in bindings)
            {
                if (pair.Value == joint)
                {
                    boneName = pair.Key;
                    return(true);
                }
            }

            boneName = "JointDoesNotBelongToARagdollBone";
            return(false);
        }
Esempio n. 4
0
        public bool TryGetBone(BoneName boneName, out RagdollBone bone)
        {
            ThrowExceptionIfNotInitialized();

            return(bones.TryGetValue(boneName, out bone));
        }
Esempio n. 5
0
 ConfigurableJoint GetBindingJoint(BoneName name)
 {
     return(bindings[name]);
 }
 public bool IsRoot(BoneName boneName)
 {
     ThrowExceptionIfIsInvalid();
     return(boneName == _root);
 }
 public BonePair(BoneName boneA, BoneName boneB)
 {
     this.boneA = boneA;
     this.boneB = boneB;
 }