123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- using System.Linq;
- using RootMotion.FinalIK;
- using UnityEngine;
- public abstract class LimbIKData : IKCtrlData
- {
- public LimbIKData(FullBodyIKCtrl ik_ctrl, FBIKChain chain, IKMappingLimb ik_mapping, Transform tgt_bone, bool use_old = false) : base(ik_ctrl, tgt_bone, use_old, false)
- {
- this.Chain = chain;
- this.IKMapping = ik_mapping;
- this.m_ChainBones = (from node in this.Chain.nodes
- select node.transform).ToArray<Transform>();
- }
- public override void SetPullState(bool pull_on)
- {
- if (this.m_OrijinPull < 0f)
- {
- this.m_OrijinPull = this.Chain.pull;
- }
- if (pull_on)
- {
- this.Chain.pull = this.m_OrijinPull;
- }
- else
- {
- this.Chain.pull = 0.1f;
- }
- }
- public override void TagetTransCpy()
- {
- base.TagetTransCpy();
- if (this.m_IsUpperBody)
- {
- this.IKMapping.weight = 0f;
- }
- }
- public override void ApplyIKSetting()
- {
- base.ApplyIKSetting();
- if (this.m_IsUpperBody)
- {
- this.IKMapping.weight = Mathf.Max(this.IKMapping.weight, Mathf.Max(this.PositionWeight, this.RotationWeight));
- }
- }
- public readonly FBIKChain Chain;
- public readonly IKMappingLimb IKMapping;
- protected bool m_IsUpperBody;
- protected float m_OrijinPull = -1f;
- }
|