IKCtrlData.cs 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358
  1. using System;
  2. using UnityEngine;
  3. public abstract class IKCtrlData
  4. {
  5. public IKCtrlData(FullBodyIKCtrl ik_ctrl, Transform tgt_bone, bool use_old = false, bool attach_ik = false)
  6. {
  7. this.MyIKCtrl = ik_ctrl;
  8. this.UseOldIK = use_old;
  9. this.m_TargetBone = tgt_bone;
  10. this.m_AttachPointIK = attach_ik;
  11. string text = (!this.MyIKCtrl.TgtChara.boMAN) ? "Bip01" : "ManBip";
  12. string name = this.m_TargetBone.name;
  13. Transform transform = this.MyIKCtrl.IKTgtRoot.Find(name);
  14. if (!transform)
  15. {
  16. transform = new GameObject(name).transform;
  17. transform.transform.SetParent(this.MyIKCtrl.IKTgtRoot, false);
  18. GameObject gameObject = new GameObject("IKTarget");
  19. gameObject.transform.SetParent(transform.transform, false);
  20. this.m_IKTarget = gameObject.transform;
  21. }
  22. else
  23. {
  24. this.m_IKTarget = transform.Find("IKTarget");
  25. }
  26. this.m_BoneTgtPair = new IKCtrlData.BoneTgtPair(this.TargetBone, this.m_IKTarget);
  27. this.IkCmoInit();
  28. this.m_PointIKData.IKCtrl = ik_ctrl;
  29. this.m_RotateIKData.IKCtrl = ik_ctrl;
  30. }
  31. public IKCtrlData.IKSettingData PointIK
  32. {
  33. get
  34. {
  35. return this.m_PointIKData;
  36. }
  37. }
  38. public IKCtrlData.IKSettingData RotateIK
  39. {
  40. get
  41. {
  42. return this.m_RotateIKData;
  43. }
  44. }
  45. public TBody.IKCMO IKCmo
  46. {
  47. get
  48. {
  49. return this.m_IKCmo;
  50. }
  51. }
  52. public bool ForceIK
  53. {
  54. get
  55. {
  56. return this.m_ForceIK;
  57. }
  58. set
  59. {
  60. this.m_ForceIK = (this.m_ForceIKEnable && value);
  61. }
  62. }
  63. public IKCtrlData.PosRotPair BlendPosRot
  64. {
  65. get
  66. {
  67. return this.m_BlendPosRot;
  68. }
  69. }
  70. public bool IsIKExec
  71. {
  72. get
  73. {
  74. return this.m_PointIKData.IsIKExec || this.m_RotateIKData.IsIKExec || this.ForceIK;
  75. }
  76. }
  77. public bool IsIKExecTruth
  78. {
  79. get
  80. {
  81. return this.IsIKExec && (this.PositionWeight > 0f || this.RotationWeight > 0f);
  82. }
  83. }
  84. public bool OldIkExec
  85. {
  86. get
  87. {
  88. return this.m_PointIKData.IsIKExec && this.m_PointIKData.IsOldIK;
  89. }
  90. }
  91. public bool AttachPointIK
  92. {
  93. get
  94. {
  95. return this.m_AttachPointIK;
  96. }
  97. }
  98. public Transform IKTarget
  99. {
  100. get
  101. {
  102. return this.m_IKTarget;
  103. }
  104. }
  105. public IKCtrlData.Vec3Enable OffsetEnable
  106. {
  107. get
  108. {
  109. return this.m_OffsetEnable;
  110. }
  111. }
  112. public virtual Transform TargetBone
  113. {
  114. get
  115. {
  116. return this.m_TargetBone;
  117. }
  118. }
  119. public bool IsSelfIKAttach { get; protected set; }
  120. public Transform[] ChainBones
  121. {
  122. get
  123. {
  124. return this.m_ChainBones;
  125. }
  126. }
  127. public abstract float PositionWeight { get; set; }
  128. public abstract float RotationWeight { get; set; }
  129. public static bool operator true(IKCtrlData data)
  130. {
  131. return data != null;
  132. }
  133. public static bool operator false(IKCtrlData data)
  134. {
  135. return data == null;
  136. }
  137. public static bool operator !(IKCtrlData data)
  138. {
  139. return data == null;
  140. }
  141. private void IkCmoInit()
  142. {
  143. if (!this.UseOldIK)
  144. {
  145. return;
  146. }
  147. this.IKCmo.Init(this.TargetBone.parent.parent, this.TargetBone.parent, this.TargetBone, this.MyIKCtrl.TgtBody);
  148. }
  149. public void SetFlagTarget(IKCtrlData.IKAttachType attach_type, string name)
  150. {
  151. if (this.MyIKCtrl.TgtChara.boMAN)
  152. {
  153. this.GetFlagData(attach_type).Target = this.MyIKCtrl.TgtBody.GetBone(name);
  154. }
  155. else
  156. {
  157. this.GetFlagData(attach_type).Target = this.MyIKCtrl.GetSTFlagObj(name);
  158. }
  159. }
  160. public void SetIKSetting(IKCtrlData.IKAttachType attachType, IKCtrlData.IKExecTiming timing, Maid tgt_maid, int slot_no, string attach_name, Transform axis_bone, Vector3 f_vecOffset, bool do_animation = false)
  161. {
  162. this.SetIKSetting(attachType, timing, tgt_maid, slot_no, attach_name, axis_bone, null, f_vecOffset, do_animation);
  163. }
  164. public void SetIKSetting(IKCtrlData.IKAttachType attachType, IKCtrlData.IKExecTiming timing, Maid tgt_maid, Transform target, Vector3 f_vecOffset, bool do_animation = false)
  165. {
  166. this.SetIKSetting(attachType, timing, tgt_maid, -1, string.Empty, null, target, f_vecOffset, do_animation);
  167. }
  168. public void SetIKSetting(IKCtrlData.IKAttachType attachType, IKCtrlData.IKExecTiming timing, Transform target, Vector3 f_vecOffset, bool do_animation = false)
  169. {
  170. this.SetIKSetting(attachType, timing, null, -1, string.Empty, null, target, f_vecOffset, do_animation);
  171. }
  172. public void SetIKSetting(IKCtrlData.IKAttachType attachType, IKCtrlData.IKExecTiming timing, Maid tgt_maid, string bone_name, Transform target, Vector3 f_vecOffset, bool do_animation = false)
  173. {
  174. this.SetIKSetting(attachType, timing, tgt_maid, -1, bone_name, null, target, f_vecOffset, do_animation);
  175. }
  176. public virtual void SetIKSetting(IKCtrlData.IKAttachType attachType, IKCtrlData.IKExecTiming timing, Maid tgt_maid, int slot_no, string attach_name, Transform axis_bone, Transform target, Vector3 f_vecOffset, bool do_animation = false)
  177. {
  178. this.GetIKSettingData(attachType).ChangeIKType(attachType);
  179. if (this.GetIKSettingData(attachType).MyType != attachType)
  180. {
  181. return;
  182. }
  183. this.MyIKCtrl.IKActive = true;
  184. this.BlendPosRot.Copy(this.m_lastIKPosRot);
  185. this.m_AnimPosRotOffset.Reset();
  186. this.m_FirstPosRotOffset.Reset();
  187. this.m_FirstTgtPosRot.Reset();
  188. if (!target && !string.IsNullOrEmpty(attach_name))
  189. {
  190. this.IsSelfIKAttach |= (tgt_maid == this.MyIKCtrl.TgtChara);
  191. }
  192. this.GetIKSettingData(attachType).SetIKSetting(timing, tgt_maid, slot_no, attach_name, axis_bone, target, f_vecOffset, do_animation);
  193. this.GetFlagData(attachType).IsFlagChange();
  194. }
  195. public virtual void SetPullState(bool pull_on)
  196. {
  197. }
  198. public void TagetTransCpy()
  199. {
  200. this.m_BoneTgtPair.Copy();
  201. float num = 0f;
  202. this.RotationWeight = num;
  203. this.PositionWeight = num;
  204. }
  205. public virtual void ApplyIKSetting()
  206. {
  207. if (this.ForceIK)
  208. {
  209. this.GetIKSettingData(IKCtrlData.IKAttachType.NewPoint).ChangeIKType(IKCtrlData.IKAttachType.NewPoint);
  210. }
  211. if (!this.MyIKCtrl.IsUpdateEnd)
  212. {
  213. this.m_EachOtherIK = false;
  214. this.ForceIK |= this.MyIKCtrl.AllForceIK;
  215. }
  216. this.ApplyIKSetting(this.GetIKSettingData(IKCtrlData.IKAttachType.NewPoint));
  217. this.ApplyIKSetting(this.GetIKSettingData(IKCtrlData.IKAttachType.Rotate));
  218. }
  219. private void ApplyIKSetting(IKCtrlData.IKSettingData data)
  220. {
  221. if (this.MyIKCtrl.IsUpdateLate)
  222. {
  223. return;
  224. }
  225. if (data.curTargetData.TgtChara && data.curTargetData.TgtChara != this.MyIKCtrl.TgtChara)
  226. {
  227. IKCtrlData ikdata = data.curTargetData.TgtChara.IKCtrl.GetIKData(data.curTargetData.Tgt_AttachName);
  228. if (ikdata != null && ikdata.IsIKExec)
  229. {
  230. IKCtrlData.IKSettingData iksettingData = ikdata.GetIKSettingData(data.MyType);
  231. this.m_EachOtherIK = this.IsEachBoneIK(iksettingData);
  232. }
  233. if (!data.curTargetData.TgtChara.body0.LateUpdateEnd && !this.MyIKCtrl.TgtBody.LateUpdateEnd)
  234. {
  235. this.MyIKCtrl.IsUpdateLate = true;
  236. if (data.curTargetData.TgtChara.IKCtrl.IsIKExec)
  237. {
  238. FullBodyIKCtrl ikctrl = data.curTargetData.TgtChara.IKCtrl;
  239. ikctrl.PostSolverUpdate = (Action)Delegate.Combine(ikctrl.PostSolverUpdate, new Action(this.MyIKCtrl.LateIKUpdate));
  240. }
  241. else
  242. {
  243. TBody body = data.curTargetData.TgtChara.body0;
  244. body.OnLateUpdateEnd = (Action)Delegate.Combine(body.OnLateUpdateEnd, new Action(this.MyIKCtrl.LateIKUpdate));
  245. }
  246. return;
  247. }
  248. }
  249. if (data.BlendType != IKCtrlData.IKBlendType.Not_Blend && data.BlendTime <= 0f)
  250. {
  251. data.BlendReset(false);
  252. }
  253. data.DoSetOffset = false;
  254. data.IsIKExec = true;
  255. Vector3 position = this.TargetBone.position;
  256. Quaternion rotation = this.TargetBone.rotation;
  257. if (this.GetFlagData(data.MyType).IsEnable)
  258. {
  259. if (!this.GetFlagData(data.MyType).BlendCtrlSelf)
  260. {
  261. IKCtrlData.IKExecTiming curExecTiming = data.changeFlagData.curExecTiming;
  262. this.MultiTgtDataToPosRot(data, IKCtrlData.IKExecTiming.Normal, curExecTiming, ref position, ref rotation);
  263. data.DoSetOffset = true;
  264. data.IsIKExec = true;
  265. }
  266. else
  267. {
  268. IKCtrlData.IKExecTiming lastExecTiming = data.changeFlagData.lastExecTiming;
  269. if (this.GetFlagData(data.MyType).IsFlagChange())
  270. {
  271. IKCtrlData.IKTargetData tgtData = data.GetTgtData(lastExecTiming);
  272. data.BlendReset(true);
  273. data.curTargetData.SetLastTarget(tgtData.Tgt_AttachName, tgtData.TgtChara, tgtData.Target, tgtData.TgtOffset);
  274. data.CheckBlendType(true);
  275. if (data.MyType == IKCtrlData.IKAttachType.Rotate)
  276. {
  277. this.BlendPosRot.rot = this.m_lastIKPosRot.rot;
  278. }
  279. else
  280. {
  281. this.BlendPosRot.pos = this.m_lastIKPosRot.pos;
  282. }
  283. this.SetIKPosRot(data, ref position, ref rotation, false, IKCtrlData.IKExecTiming.Normal);
  284. }
  285. else
  286. {
  287. this.SetIKPosRot(data, ref position, ref rotation, false, IKCtrlData.IKExecTiming.Normal);
  288. }
  289. }
  290. }
  291. else
  292. {
  293. this.SetIKPosRot(data, ref position, ref rotation, false, IKCtrlData.IKExecTiming.Normal);
  294. }
  295. if (data.IsIKExec)
  296. {
  297. if (data.FirstFrame && !data.BlendNow)
  298. {
  299. if (data.IsPointAttach)
  300. {
  301. this.m_FirstTgtPosRot.pos = position;
  302. }
  303. else
  304. {
  305. this.m_FirstTgtPosRot.rot = rotation;
  306. }
  307. }
  308. this.SetTargetTransform(data, position, rotation);
  309. if (this.m_EachOtherIK && !data.curTargetData.TgtChara.IKCtrl.IsUpdateEnd)
  310. {
  311. if (data.IsPointAttach)
  312. {
  313. this.PositionWeight *= 0.5f;
  314. }
  315. else
  316. {
  317. this.RotationWeight *= 0.5f;
  318. }
  319. }
  320. if (data.DoAnimation && !data.BlendNow)
  321. {
  322. if (!data.DoSetPosRot)
  323. {
  324. Transform targetBone = this.TargetBone;
  325. if (data.IsPointAttach)
  326. {
  327. if (!data.FirstFrame)
  328. {
  329. this.IKTarget.position += targetBone.position - this.m_FirstTgtPosRot.pos - this.m_FirstPosRotOffset.pos;
  330. }
  331. else
  332. {
  333. this.m_FirstPosRotOffset.pos = targetBone.position - this.m_FirstTgtPosRot.pos;
  334. }
  335. }
  336. else if (!data.FirstFrame)
  337. {
  338. this.IKTarget.rotation *= targetBone.rotation * Quaternion.Inverse(this.m_FirstTgtPosRot.rot) * Quaternion.Inverse(this.m_FirstPosRotOffset.rot);
  339. }
  340. else
  341. {
  342. this.m_FirstPosRotOffset.rot = targetBone.rotation * Quaternion.Inverse(this.m_FirstTgtPosRot.rot);
  343. }
  344. }
  345. }
  346. else
  347. {
  348. this.m_AnimPosRotOffset.Reset();
  349. }
  350. if (!data.BlendNow)
  351. {
  352. data.FirstFrame = false;
  353. }
  354. if (data.curTargetData.IsTgtAxis)
  355. {
  356. KasaiUtility.DrawAxis(position, rotation, 0.125f);
  357. }
  358. if (!data.DoSetPosRot && data.BlendType != IKCtrlData.IKBlendType.Not_Blend)
  359. {
  360. data.ElapsedTime += Time.deltaTime;
  361. if (data.ElapsedTime >= data.BlendTime)
  362. {
  363. data.BlendReset(false);
  364. }
  365. }
  366. data.DoSetPosRot = true;
  367. }
  368. }
  369. private void SetIKPosRot(IKCtrlData.IKSettingData setting_data, ref Vector3 pos, ref Quaternion rot, bool include_offset = false, IKCtrlData.IKExecTiming flag_type = IKCtrlData.IKExecTiming.Normal)
  370. {
  371. this.SetIKPosRot(setting_data, setting_data.GetTgtData(flag_type), ref pos, ref rot, include_offset);
  372. }
  373. private void SetIKPosRot(IKCtrlData.IKSettingData setting_data, IKCtrlData.IKTargetData tgt_data, ref Vector3 pos, ref Quaternion rot, bool include_offset = false)
  374. {
  375. if (tgt_data.Target != null)
  376. {
  377. pos = tgt_data.Target.position;
  378. rot = tgt_data.Target.rotation;
  379. }
  380. else if (tgt_data.Tgt_AttachName != string.Empty)
  381. {
  382. if (this.MyIKCtrl.TgtBody.goSlot[tgt_data.Tgt_AttachSlot].morph != null)
  383. {
  384. if (tgt_data.TgtChara != null && tgt_data.TgtChara.body0 != null)
  385. {
  386. Vector3 vector;
  387. tgt_data.TgtChara.body0.goSlot[tgt_data.Tgt_AttachSlot].morph.GetAttachPoint(tgt_data.Tgt_AttachName, out pos, out rot, out vector, false);
  388. if (setting_data.MyType == IKCtrlData.IKAttachType.NewPoint && tgt_data.AxisTgt)
  389. {
  390. rot = tgt_data.AxisTgt.rotation;
  391. }
  392. }
  393. else
  394. {
  395. setting_data.IsIKExec = false;
  396. tgt_data.Tgt_AttachName = string.Empty;
  397. }
  398. }
  399. }
  400. else if (this.ForceIK)
  401. {
  402. pos = this.m_IKTarget.position;
  403. rot = this.m_IKTarget.rotation;
  404. }
  405. else if (setting_data.BlendType == IKCtrlData.IKBlendType.IK_To_Detach)
  406. {
  407. pos = this.BlendPosRot.pos;
  408. rot = this.BlendPosRot.rot;
  409. }
  410. else
  411. {
  412. setting_data.IsIKExec = false;
  413. }
  414. if (setting_data.IsIKExec)
  415. {
  416. pos = this.GetIKEnable(setting_data.MyType).GetEnable(this.TargetBone.position, pos, false);
  417. if (include_offset)
  418. {
  419. if (setting_data.IsPointAttach)
  420. {
  421. Vector3 start = pos;
  422. switch (this.posOffsetType)
  423. {
  424. case IKCtrlData.PosOffsetType.OffsetTarget:
  425. pos += rot * tgt_data.TgtOffset;
  426. break;
  427. case IKCtrlData.PosOffsetType.OffsetWorld:
  428. pos += tgt_data.TgtOffset;
  429. break;
  430. case IKCtrlData.PosOffsetType.OffsetBone:
  431. pos -= this.TargetBone.rotation * tgt_data.TgtOffset;
  432. break;
  433. }
  434. Debug.DrawLine(start, pos, Color.white);
  435. }
  436. else
  437. {
  438. rot *= Quaternion.Euler(this.GetIKEnable(setting_data.MyType).GetEnable(tgt_data.TgtOffset, false));
  439. }
  440. }
  441. }
  442. }
  443. protected bool IsEachBoneIK(IKCtrlData.IKSettingData data)
  444. {
  445. return data.IsIKExec && data.curTargetData.Target == this.TargetBone;
  446. }
  447. private void MultiTgtDataToPosRot(IKCtrlData.IKSettingData data, IKCtrlData.IKExecTiming from, IKCtrlData.IKExecTiming to, ref Vector3 pos, ref Quaternion rot)
  448. {
  449. IKCtrlData.IKTargetData tgtData = data.GetTgtData(from);
  450. IKCtrlData.IKTargetData tgtData2 = data.GetTgtData(to);
  451. Vector3 a = pos;
  452. Quaternion a2 = rot;
  453. this.SetIKPosRot(data, tgtData, ref a, ref a2, true);
  454. Vector3 b = pos;
  455. Quaternion b2 = rot;
  456. this.SetIKPosRot(data, tgtData2, ref b, ref b2, true);
  457. float blendValue = this.GetFlagData(data.MyType).GetBlendValue(from, to);
  458. if (data.IsPointAttach)
  459. {
  460. if (!tgtData.ExistTgt)
  461. {
  462. this.m_PosWeightBase = ((!tgtData2.ExistTgt) ? 0f : blendValue);
  463. }
  464. else
  465. {
  466. this.m_PosWeightBase = 1f;
  467. }
  468. pos = Vector3.Lerp(a, b, blendValue);
  469. }
  470. else
  471. {
  472. if (!tgtData.ExistTgt)
  473. {
  474. this.m_RotWeightBase = ((!tgtData2.ExistTgt) ? 0f : blendValue);
  475. }
  476. else
  477. {
  478. this.m_RotWeightBase = 1f;
  479. }
  480. rot = Quaternion.Lerp(a2, b2, blendValue);
  481. }
  482. }
  483. protected virtual void SetTargetTransform(IKCtrlData.IKSettingData data, Vector3 pos, Quaternion rot)
  484. {
  485. IKCtrlData.IKTargetData curTargetData = data.curTargetData;
  486. switch (data.MyType)
  487. {
  488. case IKCtrlData.IKAttachType.Point:
  489. pos += this.m_AnimPosRotOffset.pos;
  490. Debug.DrawLine(pos, pos + rot * Vector3.forward * 0.2f, Color.cyan);
  491. if (!data.DoSetOffset)
  492. {
  493. this.IkCmoPorc(pos, data.curTargetData.TgtOffset);
  494. }
  495. else
  496. {
  497. this.IkCmoPorc(pos, Vector3.zero);
  498. }
  499. break;
  500. case IKCtrlData.IKAttachType.Rotate:
  501. rot *= this.m_AnimPosRotOffset.rot;
  502. if (!data.DoSetOffset)
  503. {
  504. rot *= Quaternion.Euler(this.GetIKEnable(data.MyType).GetEnable(data.curTargetData.TgtOffset, false));
  505. }
  506. this.m_IKTarget.rotation = rot;
  507. if (data.BlendType == IKCtrlData.IKBlendType.IK_To_IK)
  508. {
  509. this.m_IKTarget.rotation = Quaternion.Lerp(this.BlendPosRot.rot, this.m_IKTarget.rotation, data.BlendWeight);
  510. this.RotationWeight = this.m_RotWeightBase;
  511. }
  512. else if (data.BlendType == IKCtrlData.IKBlendType.IK_To_Detach)
  513. {
  514. this.RotationWeight = this.m_RotWeightBase * (1f - data.BlendWeight);
  515. }
  516. else
  517. {
  518. this.RotationWeight = this.m_RotWeightBase * data.BlendWeight;
  519. }
  520. break;
  521. case IKCtrlData.IKAttachType.NewPoint:
  522. pos += this.m_AnimPosRotOffset.pos;
  523. if (!data.DoSetOffset)
  524. {
  525. Vector3 start = pos;
  526. switch (this.posOffsetType)
  527. {
  528. case IKCtrlData.PosOffsetType.OffsetTarget:
  529. pos += rot * curTargetData.TgtOffset;
  530. break;
  531. case IKCtrlData.PosOffsetType.OffsetWorld:
  532. pos += curTargetData.TgtOffset;
  533. break;
  534. case IKCtrlData.PosOffsetType.OffsetBone:
  535. pos -= this.TargetBone.rotation * curTargetData.TgtOffset;
  536. break;
  537. }
  538. Debug.DrawLine(start, pos, Color.white);
  539. }
  540. this.m_IKTarget.position = pos;
  541. if (data.BlendType == IKCtrlData.IKBlendType.IK_To_IK)
  542. {
  543. this.m_IKTarget.position = Vector3.Lerp(this.BlendPosRot.pos, this.m_IKTarget.position, data.BlendWeight);
  544. this.PositionWeight = this.m_PosWeightBase;
  545. }
  546. else if (data.BlendType == IKCtrlData.IKBlendType.IK_To_Detach)
  547. {
  548. this.PositionWeight = this.m_PosWeightBase * (1f - data.BlendWeight);
  549. }
  550. else
  551. {
  552. this.PositionWeight = this.m_PosWeightBase * data.BlendWeight;
  553. }
  554. break;
  555. }
  556. data.DoSetOffset = true;
  557. }
  558. private void IkCmoPorc(Vector3 tgt, Vector3 vechand_offset)
  559. {
  560. if (!this.UseOldIK)
  561. {
  562. return;
  563. }
  564. for (int i = 0; i < 3; i++)
  565. {
  566. this.IKCmo.Porc(this.TargetBone.parent.parent, this.TargetBone.parent, this.TargetBone, tgt, vechand_offset, this);
  567. }
  568. }
  569. public virtual void Update()
  570. {
  571. }
  572. public virtual void LateUpdate()
  573. {
  574. this.SaveLastBonePosRot();
  575. this.GetIKSettingData(IKCtrlData.IKAttachType.NewPoint).DoSetPosRot = (this.GetIKSettingData(IKCtrlData.IKAttachType.Rotate).DoSetPosRot = false);
  576. }
  577. public virtual void SaveLastBonePosRot()
  578. {
  579. this.m_lastIKPosRot.Copy(this.m_TargetBone);
  580. }
  581. public virtual void Detach(IKCtrlData.IKAttachType attachType)
  582. {
  583. this.ForceIK = false;
  584. this.m_BoneTgtPair.PosOffset = Vector3.zero;
  585. this.IsSelfIKAttach = false;
  586. this.BlendPosRot.Copy(this.m_lastIKPosRot);
  587. this.GetFlagData(attachType).Reset();
  588. this.GetIKSettingData(attachType).Detach();
  589. }
  590. public IKCtrlData.IKSettingData GetIKSettingData(IKCtrlData.IKAttachType attach_type)
  591. {
  592. if (attach_type == IKCtrlData.IKAttachType.Rotate)
  593. {
  594. return this.m_RotateIKData;
  595. }
  596. return this.m_PointIKData;
  597. }
  598. public IKCtrlData.ChangeFlagData GetFlagData(IKCtrlData.IKAttachType attach_type)
  599. {
  600. return this.GetIKSettingData(attach_type).changeFlagData;
  601. }
  602. public IKCtrlData.IKTargetData GetTargetData(IKCtrlData.IKAttachType attach_type)
  603. {
  604. return this.GetIKSettingData(attach_type).curTargetData;
  605. }
  606. public IKCtrlData.IKTargetData GetTargetData(IKCtrlData.IKAttachType attach_type, IKCtrlData.IKExecTiming exec_timing)
  607. {
  608. return this.GetIKSettingData(attach_type).GetTgtData(exec_timing);
  609. }
  610. private bool IsIKTargetChara(IKCtrlData.IKAttachType attach_type, Maid chara)
  611. {
  612. IKCtrlData.IKSettingData iksettingData = this.GetIKSettingData(attach_type);
  613. foreach (IKCtrlData.IKExecTiming timing in (IKCtrlData.IKExecTiming[])Enum.GetValues(typeof(IKCtrlData.IKExecTiming)))
  614. {
  615. IKCtrlData.IKTargetData tgtData = iksettingData.GetTgtData(timing);
  616. if (tgtData.TgtChara == chara)
  617. {
  618. return true;
  619. }
  620. }
  621. return false;
  622. }
  623. public bool IsIKTargetChara(Maid chara)
  624. {
  625. return this.IsIKTargetChara(IKCtrlData.IKAttachType.NewPoint, chara) || this.IsIKTargetChara(IKCtrlData.IKAttachType.Rotate, chara);
  626. }
  627. public IKCtrlData.Vec3Enable GetIKEnable(IKCtrlData.IKAttachType attach_type)
  628. {
  629. return this.GetIKSettingData(attach_type).offsetEnable;
  630. }
  631. [SerializeField]
  632. [Header("位置IK")]
  633. private IKCtrlData.IKSettingData m_PointIKData = new IKCtrlData.IKSettingData(IKCtrlData.IKAttachType.NewPoint);
  634. [SerializeField]
  635. [Header("回転IK")]
  636. private IKCtrlData.IKSettingData m_RotateIKData = new IKCtrlData.IKSettingData(IKCtrlData.IKAttachType.Rotate);
  637. private TBody.IKCMO m_IKCmo = new TBody.IKCMO();
  638. private IKCtrlData.PosRotPair m_BlendPosRot = new IKCtrlData.PosRotPair();
  639. [SerializeField]
  640. [Space]
  641. private IKCtrlData.PosRotPair m_AnimPosRotOffset = new IKCtrlData.PosRotPair();
  642. private IKCtrlData.PosRotPair m_FirstPosRotOffset = new IKCtrlData.PosRotPair();
  643. [SerializeField]
  644. private bool m_AttachPointIK;
  645. [SerializeField]
  646. private Transform m_TargetBone;
  647. [SerializeField]
  648. private Transform m_IKTarget;
  649. [SerializeField]
  650. private bool m_DrawLine = true;
  651. private IKCtrlData.BoneTgtPair m_BoneTgtPair;
  652. protected IKCtrlData.PosRotPair m_FirstTgtPosRot = new IKCtrlData.PosRotPair();
  653. protected IKCtrlData.PosRotPair m_lastIKPosRot = new IKCtrlData.PosRotPair();
  654. [SerializeField]
  655. [Range(0f, 1f)]
  656. protected float m_PosWeightBase = 1f;
  657. [SerializeField]
  658. [Range(0f, 1f)]
  659. protected float m_RotWeightBase = 1f;
  660. [SerializeField]
  661. protected bool m_ForceIK;
  662. protected bool m_ForceIKEnable;
  663. protected bool m_EachOtherIK;
  664. protected IKCtrlData.Vec3Enable m_OffsetEnable = new IKCtrlData.Vec3Enable();
  665. [Space]
  666. public IKCtrlData.PosOffsetType posOffsetType;
  667. public readonly FullBodyIKCtrl MyIKCtrl;
  668. public readonly bool UseOldIK;
  669. protected Transform[] m_ChainBones;
  670. public enum IKAttachType
  671. {
  672. Point,
  673. Rotate,
  674. NewPoint
  675. }
  676. public enum IKBlendType
  677. {
  678. Detach_To_IK,
  679. IK_To_IK,
  680. IK_To_Detach,
  681. Not_Blend
  682. }
  683. public enum PosOffsetType
  684. {
  685. OffsetTarget,
  686. OffsetWorld,
  687. OffsetBone
  688. }
  689. public enum IKExecTiming
  690. {
  691. Normal,
  692. FlagPositive,
  693. FlagNegative = -1
  694. }
  695. [Serializable]
  696. public class Vec3Enable
  697. {
  698. public bool AnyDisable
  699. {
  700. get
  701. {
  702. return !this.EnableX || !this.EnableY || !this.EnableZ;
  703. }
  704. }
  705. public Vector3 GetEnable(Vector3 pos, bool inverse = false)
  706. {
  707. if (this.EnableX == inverse)
  708. {
  709. pos.x = 0f;
  710. }
  711. if (this.EnableY == inverse)
  712. {
  713. pos.y = 0f;
  714. }
  715. if (this.EnableZ == inverse)
  716. {
  717. pos.z = 0f;
  718. }
  719. return pos;
  720. }
  721. public Vector3 GetEnable(Vector3 from, Vector3 to, bool inverse = false)
  722. {
  723. if (this.EnableX == inverse)
  724. {
  725. to.x = from.x;
  726. }
  727. if (this.EnableY == inverse)
  728. {
  729. to.y = from.y;
  730. }
  731. if (this.EnableZ == inverse)
  732. {
  733. to.z = from.z;
  734. }
  735. return to;
  736. }
  737. public void Recet()
  738. {
  739. this.EnableX = (this.EnableY = (this.EnableZ = true));
  740. }
  741. public void Copy(IKCtrlData.Vec3Enable cpy)
  742. {
  743. this.EnableX = cpy.EnableX;
  744. this.EnableY = cpy.EnableY;
  745. this.EnableZ = cpy.EnableZ;
  746. }
  747. public string OffEnableToStr()
  748. {
  749. if (!this.AnyDisable)
  750. {
  751. return string.Empty;
  752. }
  753. string text = " disable=";
  754. if (!this.EnableX)
  755. {
  756. text += "x";
  757. }
  758. if (!this.EnableY)
  759. {
  760. if (!this.EnableX)
  761. {
  762. text += ",";
  763. }
  764. text += "y";
  765. }
  766. if (!this.EnableZ)
  767. {
  768. if (!this.EnableX || !this.EnableY)
  769. {
  770. text += ",";
  771. }
  772. text += "z";
  773. }
  774. return text;
  775. }
  776. public bool EnableX = true;
  777. public bool EnableY = true;
  778. public bool EnableZ = true;
  779. }
  780. [Serializable]
  781. public class PosRotPair
  782. {
  783. public void Reset()
  784. {
  785. this.pos = Vector3.zero;
  786. this.rot = new Quaternion(0f, 0f, 0f, 1f);
  787. }
  788. public void Copy(IKCtrlData.PosRotPair pair)
  789. {
  790. this.pos = pair.pos;
  791. this.rot = pair.rot;
  792. }
  793. public void Copy(Transform transform)
  794. {
  795. this.pos = transform.position;
  796. this.rot = transform.rotation;
  797. }
  798. public void DrawAxis()
  799. {
  800. KasaiUtility.DrawAxis(this.pos, this.rot, 0.0625f);
  801. }
  802. public Vector3 pos = Vector3.zero;
  803. public Quaternion rot = new Quaternion(0f, 0f, 0f, 1f);
  804. }
  805. public class BoneTgtPair
  806. {
  807. public BoneTgtPair(Transform bone, Transform target)
  808. {
  809. this.Bone = bone;
  810. this.Target = target;
  811. }
  812. public void Copy()
  813. {
  814. this.Target.position = this.Bone.position + this.PosOffset;
  815. this.Target.rotation = this.Bone.rotation;
  816. }
  817. public readonly Transform Bone;
  818. public readonly Transform Target;
  819. public Vector3 PosOffset = Vector3.zero;
  820. }
  821. [Serializable]
  822. public class ChangeFlagData
  823. {
  824. public bool IsEnable
  825. {
  826. get
  827. {
  828. return this.Target != null;
  829. }
  830. }
  831. public IKCtrlData.IKExecTiming lastExecTiming { get; private set; }
  832. public IKCtrlData.IKExecTiming curExecTiming
  833. {
  834. get
  835. {
  836. if (this.GetFlagValue() > 0f)
  837. {
  838. return IKCtrlData.IKExecTiming.FlagPositive;
  839. }
  840. if (this.GetFlagValue() < 0f)
  841. {
  842. return IKCtrlData.IKExecTiming.FlagNegative;
  843. }
  844. return IKCtrlData.IKExecTiming.Normal;
  845. }
  846. }
  847. public float GetFlagValue()
  848. {
  849. if (!this.Target)
  850. {
  851. return 0f;
  852. }
  853. return Vector3.Dot(this.Target.localPosition, this.Axis) / this.OnValue;
  854. }
  855. public float GetBlendValue(IKCtrlData.IKExecTiming from, IKCtrlData.IKExecTiming to)
  856. {
  857. if (from == to)
  858. {
  859. return 1f;
  860. }
  861. return Mathf.InverseLerp((float)from, (float)to, this.GetFlagValue());
  862. }
  863. public bool IsFlagChange()
  864. {
  865. if (!this.Target)
  866. {
  867. return false;
  868. }
  869. IKCtrlData.IKExecTiming lastExecTiming = this.lastExecTiming;
  870. this.lastExecTiming = this.curExecTiming;
  871. return lastExecTiming != this.lastExecTiming;
  872. }
  873. public void Reset()
  874. {
  875. this.Target = null;
  876. this.lastExecTiming = IKCtrlData.IKExecTiming.Normal;
  877. this.BlendCtrlSelf = false;
  878. }
  879. public Transform Target;
  880. public Vector3 Axis = Vector3.forward;
  881. public float OnValue = 0.1f;
  882. [HideInInspector]
  883. public bool BlendCtrlSelf;
  884. }
  885. [Serializable]
  886. public class IKTargetData
  887. {
  888. public IKTargetData(bool is_for_point)
  889. {
  890. this.IsForPointTarget = is_for_point;
  891. }
  892. public string lastAttachName
  893. {
  894. get
  895. {
  896. return this.m_LastAttachName;
  897. }
  898. }
  899. public Transform lastTarget
  900. {
  901. get
  902. {
  903. return this.m_LastTarget;
  904. }
  905. }
  906. public Maid lastTgtChara
  907. {
  908. get
  909. {
  910. return this.m_LastTgtChara;
  911. }
  912. }
  913. public Vector3 lastOffset
  914. {
  915. get
  916. {
  917. return this.m_LastOffset;
  918. }
  919. }
  920. public bool ExistTgt
  921. {
  922. get
  923. {
  924. return this.Target != null || !string.IsNullOrEmpty(this.Tgt_AttachName);
  925. }
  926. }
  927. public bool IsEachOtherIK(bool check_update = false)
  928. {
  929. return this.TgtChara && this.TgtChara.IKCtrl.IsIKExec && this.TgtChara.IKCtrl.IsUpdateEnd == check_update;
  930. }
  931. public void SaveLastTarget()
  932. {
  933. this.m_LastAttachName = this.Tgt_AttachName;
  934. this.m_LastTgtChara = this.TgtChara;
  935. this.m_LastTarget = this.Target;
  936. this.m_LastOffset = this.TgtOffset;
  937. }
  938. public void SetLastTarget(string attach_name, Maid maid, Transform target, Vector3 offset)
  939. {
  940. this.m_LastAttachName = attach_name;
  941. this.m_LastTgtChara = maid;
  942. this.m_LastTarget = target;
  943. this.m_LastOffset = offset;
  944. }
  945. public void SetIKSetting(Maid tgt_maid, int slot_no, string attach_name, Transform axis_bone, Transform target, Vector3 f_vecOffset)
  946. {
  947. this.SetLastTarget(this.Tgt_AttachName, this.TgtChara, this.Target, this.TgtOffset);
  948. this.TgtChara = tgt_maid;
  949. this.Tgt_AttachSlot = slot_no;
  950. this.Tgt_AttachName = attach_name;
  951. this.Target = target;
  952. this.AxisTgt = axis_bone;
  953. if (this.IsForPointTarget)
  954. {
  955. this.TgtOffset = f_vecOffset;
  956. }
  957. else
  958. {
  959. this.TgtOffset = KasaiUtility.AngleRimmit360(f_vecOffset);
  960. }
  961. this.IsIKExec = true;
  962. }
  963. public void Detach()
  964. {
  965. this.SetLastTarget(this.Tgt_AttachName, this.TgtChara, this.Target, this.TgtOffset);
  966. this.TgtChara = null;
  967. this.Tgt_AttachSlot = -1;
  968. this.Tgt_AttachName = string.Empty;
  969. this.Target = null;
  970. this.AxisTgt = null;
  971. this.TgtOffset = Vector3.zero;
  972. }
  973. private string m_LastAttachName = string.Empty;
  974. private Transform m_LastTarget;
  975. private Maid m_LastTgtChara;
  976. private Vector3 m_LastOffset = Vector3.zero;
  977. public Transform Target;
  978. public Vector3 TgtOffset;
  979. public int Tgt_AttachSlot = -1;
  980. public string Tgt_AttachName = string.Empty;
  981. public Maid TgtChara;
  982. public bool IsTgtAxis;
  983. public bool IsIKExec;
  984. public Transform AxisTgt;
  985. public readonly bool IsForPointTarget;
  986. }
  987. [Serializable]
  988. public class IKSettingData
  989. {
  990. public IKSettingData(IKCtrlData.IKAttachType type)
  991. {
  992. this.MyType = type;
  993. this.BlendType = IKCtrlData.IKBlendType.Not_Blend;
  994. this.m_NormalTgtData = new IKCtrlData.IKTargetData(this.IsPointAttach);
  995. this.m_FlagPositiveTgtData = new IKCtrlData.IKTargetData(this.IsPointAttach);
  996. this.m_FlagNegativeTgtData = new IKCtrlData.IKTargetData(this.IsPointAttach);
  997. }
  998. public IKCtrlData.Vec3Enable offsetEnable
  999. {
  1000. get
  1001. {
  1002. return this.m_OffsetEnable;
  1003. }
  1004. }
  1005. public IKCtrlData.ChangeFlagData changeFlagData
  1006. {
  1007. get
  1008. {
  1009. return this.m_ChangeFlagData;
  1010. }
  1011. }
  1012. public IKCtrlData.IKTargetData curTargetData
  1013. {
  1014. get
  1015. {
  1016. IKCtrlData.IKExecTiming curExecTiming = this.changeFlagData.curExecTiming;
  1017. if (curExecTiming == IKCtrlData.IKExecTiming.FlagPositive)
  1018. {
  1019. return this.m_FlagPositiveTgtData;
  1020. }
  1021. if (curExecTiming != IKCtrlData.IKExecTiming.FlagNegative)
  1022. {
  1023. return this.m_NormalTgtData;
  1024. }
  1025. return this.m_FlagNegativeTgtData;
  1026. }
  1027. }
  1028. public float BlendTime
  1029. {
  1030. get
  1031. {
  1032. return (!this.IKCtrl) ? -1f : this.IKCtrl.BlendTime;
  1033. }
  1034. }
  1035. public IKCtrlData.IKAttachType MyType { get; private set; }
  1036. public IKCtrlData.IKBlendType BlendType { get; private set; }
  1037. public bool DoIKBlend
  1038. {
  1039. get
  1040. {
  1041. return this.m_DoIKBlend && this.BlendTime > 0f;
  1042. }
  1043. }
  1044. public bool IsPointAttach
  1045. {
  1046. get
  1047. {
  1048. return this.MyType != IKCtrlData.IKAttachType.Rotate;
  1049. }
  1050. }
  1051. public bool NeedBlend
  1052. {
  1053. get
  1054. {
  1055. return this.BlendTime > 0f && this.BlendType != IKCtrlData.IKBlendType.Not_Blend;
  1056. }
  1057. }
  1058. public float BlendWeight
  1059. {
  1060. get
  1061. {
  1062. return (!this.NeedBlend || !this.DoIKBlend) ? 1f : Mathf.Clamp01(this.ElapsedTime / this.BlendTime);
  1063. }
  1064. }
  1065. public bool BlendNow
  1066. {
  1067. get
  1068. {
  1069. return this.NeedBlend && this.ElapsedTime < this.BlendTime;
  1070. }
  1071. }
  1072. public bool IsOldIK
  1073. {
  1074. get
  1075. {
  1076. return this.MyType == IKCtrlData.IKAttachType.Point;
  1077. }
  1078. }
  1079. public void ChangeIKType(IKCtrlData.IKAttachType type)
  1080. {
  1081. if (this.MyType == IKCtrlData.IKAttachType.Rotate)
  1082. {
  1083. return;
  1084. }
  1085. this.MyType = type;
  1086. }
  1087. public void CheckBlendType(bool check_time = true)
  1088. {
  1089. this.BlendType = IKCtrlData.IKBlendType.IK_To_IK;
  1090. this.m_DoIKBlend = true;
  1091. float num = Vector3.Distance(this.curTargetData.lastOffset, this.curTargetData.TgtOffset);
  1092. if (this.curTargetData.lastTarget)
  1093. {
  1094. if (!this.curTargetData.Target && string.IsNullOrEmpty(this.curTargetData.Tgt_AttachName))
  1095. {
  1096. this.BlendType = IKCtrlData.IKBlendType.IK_To_Detach;
  1097. }
  1098. else if (this.curTargetData.Target)
  1099. {
  1100. this.m_DoIKBlend = (this.curTargetData.lastTarget != this.curTargetData.Target || num > 0.01f);
  1101. }
  1102. }
  1103. else if (!string.IsNullOrEmpty(this.curTargetData.lastAttachName))
  1104. {
  1105. if (string.IsNullOrEmpty(this.curTargetData.Tgt_AttachName) && !this.curTargetData.Target)
  1106. {
  1107. this.BlendType = IKCtrlData.IKBlendType.IK_To_Detach;
  1108. }
  1109. else if (!this.curTargetData.Target)
  1110. {
  1111. this.m_DoIKBlend = (this.curTargetData.lastAttachName != this.curTargetData.Tgt_AttachName || this.curTargetData.lastTgtChara != this.curTargetData.TgtChara || num > 0.01f);
  1112. }
  1113. }
  1114. else
  1115. {
  1116. this.BlendType = IKCtrlData.IKBlendType.Detach_To_IK;
  1117. if (!this.curTargetData.Target && string.IsNullOrEmpty(this.curTargetData.Tgt_AttachName))
  1118. {
  1119. this.BlendType = IKCtrlData.IKBlendType.Not_Blend;
  1120. this.m_DoIKBlend = false;
  1121. }
  1122. }
  1123. }
  1124. public void BlendReset(bool elpsed_only = false)
  1125. {
  1126. this.ElapsedTime = 0f;
  1127. if (!elpsed_only)
  1128. {
  1129. this.m_DoIKBlend = false;
  1130. this.BlendType = IKCtrlData.IKBlendType.Not_Blend;
  1131. }
  1132. }
  1133. public IKCtrlData.IKTargetData GetTgtData(IKCtrlData.IKExecTiming timing)
  1134. {
  1135. if (timing == IKCtrlData.IKExecTiming.FlagPositive)
  1136. {
  1137. return this.m_FlagPositiveTgtData;
  1138. }
  1139. if (timing != IKCtrlData.IKExecTiming.FlagNegative)
  1140. {
  1141. return this.m_NormalTgtData;
  1142. }
  1143. return this.m_FlagNegativeTgtData;
  1144. }
  1145. public void SetIKSetting(IKCtrlData.IKExecTiming timing, Maid tgt_chara, int slot_no, string attach_name, Transform axis_bone, Transform target, Vector3 f_vecOffset, bool do_animation)
  1146. {
  1147. this.BlendReset(false);
  1148. this.DoAnimation = do_animation;
  1149. this.IsIKExec = true;
  1150. this.FirstFrame = true;
  1151. this.GetTgtData(timing).SetIKSetting(tgt_chara, slot_no, attach_name, axis_bone, target, f_vecOffset);
  1152. this.CheckBlendType(true);
  1153. this.m_ChangeFlagData.IsFlagChange();
  1154. }
  1155. public void Detach()
  1156. {
  1157. this.BlendReset(false);
  1158. this.m_NormalTgtData.Detach();
  1159. this.m_FlagPositiveTgtData.Detach();
  1160. this.m_FlagNegativeTgtData.Detach();
  1161. this.CheckBlendType(true);
  1162. this.m_ChangeFlagData.Reset();
  1163. this.DoSetOffset = false;
  1164. this.DoSetPosRot = false;
  1165. this.DoAnimation = false;
  1166. this.IsIKExec = false;
  1167. this.FirstFrame = false;
  1168. }
  1169. [SerializeField]
  1170. [Header("通常時のターゲットデータ")]
  1171. private IKCtrlData.IKTargetData m_NormalTgtData;
  1172. [SerializeField]
  1173. [Header("フラグ値が0以上のときのターゲットデータ")]
  1174. private IKCtrlData.IKTargetData m_FlagPositiveTgtData;
  1175. [SerializeField]
  1176. [Header("フラグ値が0以下のときのターゲットデータ")]
  1177. private IKCtrlData.IKTargetData m_FlagNegativeTgtData;
  1178. [SerializeField]
  1179. [Space]
  1180. private IKCtrlData.Vec3Enable m_OffsetEnable = new IKCtrlData.Vec3Enable();
  1181. [SerializeField]
  1182. private IKCtrlData.ChangeFlagData m_ChangeFlagData = new IKCtrlData.ChangeFlagData();
  1183. private bool m_DoIKBlend;
  1184. public bool IsIKExec;
  1185. public float ElapsedTime;
  1186. [HideInInspector]
  1187. public bool FirstFrame;
  1188. public bool DoAnimation;
  1189. [HideInInspector]
  1190. public bool DoSetPosRot;
  1191. [HideInInspector]
  1192. public bool DoSetOffset;
  1193. [HideInInspector]
  1194. public FullBodyIKCtrl IKCtrl;
  1195. }
  1196. }