LimbIKData.cs 716 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Linq;
  3. using RootMotion.FinalIK;
  4. using UnityEngine;
  5. public abstract class LimbIKData : IKCtrlData
  6. {
  7. public LimbIKData(FullBodyIKCtrl ik_ctrl, FBIKChain chain, Transform tgt_bone, bool use_old = false) : base(ik_ctrl, tgt_bone, use_old, false)
  8. {
  9. this.Chain = chain;
  10. this.m_ChainBones = (from node in this.Chain.nodes
  11. select node.transform).ToArray<Transform>();
  12. }
  13. public override void SetPullState(bool pull_on)
  14. {
  15. if (this.m_OrijinPull < 0f)
  16. {
  17. this.m_OrijinPull = this.Chain.pull;
  18. }
  19. if (pull_on)
  20. {
  21. this.Chain.pull = this.m_OrijinPull;
  22. }
  23. else
  24. {
  25. this.Chain.pull = 0.1f;
  26. }
  27. }
  28. public readonly FBIKChain Chain;
  29. protected float m_OrijinPull = -1f;
  30. }