using System; using RootMotion.FinalIK; using UnityEngine; [Serializable] public class ElbowKneeIKData : LimbIKData { public ElbowKneeIKData(FBIKChain chain, FullBodyIKCtrl ik_ctrl, Transform tgt_bone) : base(ik_ctrl, chain, tgt_bone, false) { this.Chain.bendConstraint.bendGoal = base.IKTarget; this.PositionWeight = 0f; this.m_ForceIKEnable = true; } public override float PositionWeight { get { return this.Chain.bendConstraint.weight; } set { this.Chain.bendConstraint.weight = value; } } public override float RotationWeight { get; set; } public ShoulderThighIKData ShoulderThighData { get { return this.m_ShoulderThighData; } } public HandFootIKData HandFootData { get { return this.m_HandFootData; } } protected override void SetTargetTransform(IKCtrlData.IKSettingData data, Vector3 pos, Quaternion rot) { base.SetTargetTransform(data, pos, rot); Vector3 position = this.m_ShoulderThighData.TargetBone.InverseTransformPoint(this.TargetBone.position); Vector3 vector = this.TargetBone.InverseTransformPoint(this.m_HandFootData.TargetBone.position); Transform iktarget = this.m_HandFootData.IKTarget; Transform iktarget2 = this.m_ShoulderThighData.IKTarget; if (data.IsPointAttach) { if (!this.m_ShoulderThighData.GetIKSettingData(IKCtrlData.IKAttachType.NewPoint).IsIKExec) { this.m_ShoulderThighData.PositionWeight = this.PositionWeight; Vector3 b = base.IKTarget.position - iktarget2.TransformPoint(position); iktarget2.position += b; } if (!this.m_ShoulderThighData.GetIKSettingData(IKCtrlData.IKAttachType.Rotate).IsIKExec) { this.m_ShoulderThighData.RotationWeight = this.PositionWeight; iktarget2.rotation = Quaternion.FromToRotation(this.TargetBone.position - this.ShoulderThighData.TargetBone.position, base.IKTarget.position - iktarget2.position) * iktarget2.rotation; } } } public void SetChainData(HandFootIKData handfoot_data, ShoulderThighIKData shoulderthigh_data) { this.m_HandFootData = handfoot_data; this.m_ShoulderThighData = shoulderthigh_data; } private ShoulderThighIKData m_ShoulderThighData; private HandFootIKData m_HandFootData; }