DynamicSkirtBone.cs 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Runtime.InteropServices;
  5. using UnityEngine;
  6. public class DynamicSkirtBone : MonoBehaviour
  7. {
  8. [DllImport("kernel32.dll")]
  9. private static extern IntPtr LoadLibraryW(byte[] dllToLoad);
  10. [DllImport("kernel32.dll")]
  11. private static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
  12. [DllImport("kernel32.dll")]
  13. private static extern bool FreeLibrary(IntPtr hModule);
  14. public bool SerializeWrite(BinaryWriter f_bw)
  15. {
  16. f_bw.Write("CM3D21_PSK");
  17. f_bw.Write(1170);
  18. f_bw.Write(this.m_fPanierRadius);
  19. this.SerializeWriteAnimationCurve(f_bw, this.m_PanierRadiusDistrib);
  20. int num = (this.m_PanierRadiusDistribGroup == null) ? 0 : this.m_PanierRadiusDistribGroup.Length;
  21. f_bw.Write(num);
  22. for (int i = 0; i < num; i++)
  23. {
  24. DynamicSkirtBone.PanierRadiusGroup panierRadiusGroup = this.m_PanierRadiusDistribGroup[i];
  25. f_bw.Write(panierRadiusGroup.strBoneName);
  26. f_bw.Write(panierRadiusGroup.fRadius);
  27. this.SerializeWriteAnimationCurve(f_bw, panierRadiusGroup.Curve);
  28. }
  29. f_bw.Write(this.m_fPanierForce);
  30. this.SerializeWriteAnimationCurve(f_bw, this.m_PanierForceDistrib);
  31. f_bw.Write(this.m_fPanierStressForce);
  32. f_bw.Write(this.m_fStressDgreeMin);
  33. f_bw.Write(this.m_fStressDgreeMax);
  34. f_bw.Write(this.m_fStressMinScale);
  35. f_bw.Write(this.m_fScaleEaseSpeed);
  36. f_bw.Write(this.m_fPanierForceDistanceThreshold);
  37. f_bw.Write(this.m_nCalcTime);
  38. f_bw.Write(this.m_fVelocityForceRate);
  39. this.SerializeWriteAnimationCurve(f_bw, this.m_VelocityForceRateDistrib);
  40. f_bw.Write(this.m_vGravity.x);
  41. f_bw.Write(this.m_vGravity.y);
  42. f_bw.Write(this.m_vGravity.z);
  43. this.SerializeWriteAnimationCurve(f_bw, this.m_GravityDistrib);
  44. f_bw.Write(this.m_aryHard[0]);
  45. f_bw.Write(this.m_aryHard[1]);
  46. f_bw.Write(this.m_aryHard[2]);
  47. f_bw.Write(this.m_aryHard[3]);
  48. return true;
  49. }
  50. private void SerializeWriteAnimationCurve(BinaryWriter f_bw, AnimationCurve f_ac)
  51. {
  52. Keyframe[] keys = f_ac.keys;
  53. f_bw.Write(keys.Length);
  54. for (int i = 0; i < keys.Length; i++)
  55. {
  56. f_bw.Write(keys[i].time);
  57. f_bw.Write(keys[i].value);
  58. f_bw.Write(keys[i].inTangent);
  59. f_bw.Write(keys[i].outTangent);
  60. }
  61. }
  62. public void SerializeRead(BinaryReader f_br)
  63. {
  64. string a = f_br.ReadString();
  65. if (a != "CM3D21_PSK")
  66. {
  67. NDebug.Assert("物理スカート定義ヘッダー不正", false);
  68. }
  69. int num = f_br.ReadInt32();
  70. this.m_fPanierRadius = f_br.ReadSingle();
  71. this.SerializeReadAnimationCurve(f_br, out this.m_PanierRadiusDistrib);
  72. if (217 <= num)
  73. {
  74. int num2 = f_br.ReadInt32();
  75. if (num2 != 0)
  76. {
  77. this.m_PanierRadiusDistribGroup = new DynamicSkirtBone.PanierRadiusGroup[num2];
  78. }
  79. for (int i = 0; i < num2; i++)
  80. {
  81. DynamicSkirtBone.PanierRadiusGroup panierRadiusGroup = new DynamicSkirtBone.PanierRadiusGroup();
  82. panierRadiusGroup.strBoneName = f_br.ReadString();
  83. panierRadiusGroup.fRadius = f_br.ReadSingle();
  84. this.SerializeReadAnimationCurve(f_br, out panierRadiusGroup.Curve);
  85. this.m_PanierRadiusDistribGroup[i] = panierRadiusGroup;
  86. }
  87. }
  88. this.m_fPanierForce = f_br.ReadSingle();
  89. this.SerializeReadAnimationCurve(f_br, out this.m_PanierForceDistrib);
  90. this.m_fPanierStressForce = f_br.ReadSingle();
  91. this.m_fStressDgreeMin = f_br.ReadSingle();
  92. this.m_fStressDgreeMax = f_br.ReadSingle();
  93. this.m_fStressMinScale = f_br.ReadSingle();
  94. this.m_fScaleEaseSpeed = f_br.ReadSingle();
  95. this.m_fPanierForceDistanceThreshold = f_br.ReadSingle();
  96. this.m_nCalcTime = f_br.ReadInt32();
  97. this.m_fVelocityForceRate = f_br.ReadSingle();
  98. this.SerializeReadAnimationCurve(f_br, out this.m_VelocityForceRateDistrib);
  99. this.m_vGravity.x = f_br.ReadSingle();
  100. this.m_vGravity.y = f_br.ReadSingle();
  101. this.m_vGravity.z = f_br.ReadSingle();
  102. this.SerializeReadAnimationCurve(f_br, out this.m_GravityDistrib);
  103. this.m_aryHard[0] = f_br.ReadSingle();
  104. this.m_aryHard[1] = f_br.ReadSingle();
  105. this.m_aryHard[2] = f_br.ReadSingle();
  106. this.m_aryHard[3] = f_br.ReadSingle();
  107. this.UpdateParameters();
  108. }
  109. private void SerializeReadAnimationCurve(BinaryReader f_br, out AnimationCurve f_ac)
  110. {
  111. int num = f_br.ReadInt32();
  112. f_ac = null;
  113. if (num != 0)
  114. {
  115. Keyframe[] array = new Keyframe[num];
  116. for (int i = 0; i < num; i++)
  117. {
  118. array[i] = new Keyframe
  119. {
  120. time = f_br.ReadSingle(),
  121. value = f_br.ReadSingle(),
  122. inTangent = f_br.ReadSingle(),
  123. outTangent = f_br.ReadSingle()
  124. };
  125. }
  126. f_ac = new AnimationCurve(array);
  127. }
  128. }
  129. public bool InitGameObject(GameObject f_objRoot, TBodySkin bodyskin, Transform f_trSkirtRoot)
  130. {
  131. this.m_BodySkin = bodyskin;
  132. this.m_Body = bodyskin.body;
  133. if (DynamicSkirtBone.m_PluginDll == IntPtr.Zero)
  134. {
  135. string text = Application.dataPath + '/' + "Plugins/clothpp.dll";
  136. Debug.Log("Application.dataPath is " + text);
  137. DynamicSkirtBone.m_PluginDll = DynamicSkirtBone.LoadLibraryW(NUty.ConvStringToByte(text, NUty.ENCO.UTF_16));
  138. IntPtr procAddress = DynamicSkirtBone.GetProcAddress(DynamicSkirtBone.m_PluginDll, "Export_PhysicsCreate");
  139. DynamicSkirtBone.m_dgExport_PhysicsCreate = (DynamicSkirtBone.Export_PhysicsCreate)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(DynamicSkirtBone.Export_PhysicsCreate));
  140. IntPtr procAddress2 = DynamicSkirtBone.GetProcAddress(DynamicSkirtBone.m_PluginDll, "Export_PhysicsDelete");
  141. DynamicSkirtBone.m_dgExport_PhysicsDelete = (DynamicSkirtBone.Export_PhysicsDelete)Marshal.GetDelegateForFunctionPointer(procAddress2, typeof(DynamicSkirtBone.Export_PhysicsDelete));
  142. IntPtr procAddress3 = DynamicSkirtBone.GetProcAddress(DynamicSkirtBone.m_PluginDll, "Export_InitSkirt");
  143. DynamicSkirtBone.m_dgExport_InitSkirt = (DynamicSkirtBone.Export_InitSkirt)Marshal.GetDelegateForFunctionPointer(procAddress3, typeof(DynamicSkirtBone.Export_InitSkirt));
  144. IntPtr procAddress4 = DynamicSkirtBone.GetProcAddress(DynamicSkirtBone.m_PluginDll, "Export_GetBonePos");
  145. DynamicSkirtBone.m_dgExport_GetBonePos = (DynamicSkirtBone.Export_GetBonePos)Marshal.GetDelegateForFunctionPointer(procAddress4, typeof(DynamicSkirtBone.Export_GetBonePos));
  146. }
  147. NDebug.Assert(this.m_nDllPhysicsInstanceID == -1, () => "Skirt DLL多重ロード。");
  148. this.m_nDllPhysicsInstanceID = DynamicSkirtBone.m_dgExport_PhysicsCreate();
  149. this.m_nBoneCount = 0;
  150. this.m_listBoneScaleDef.Clear();
  151. this.m_listHookBoneTrs = new List<Transform>();
  152. int num = -1;
  153. int num2 = f_trSkirtRoot.childCount - 1;
  154. while (0 <= num2)
  155. {
  156. Transform child = f_trSkirtRoot.GetChild(num2);
  157. if (child.name.Contains("Skirt") && child.name.Contains("_A_"))
  158. {
  159. int num3 = int.Parse(child.name.Substring(5, 2)) - 1;
  160. if (num == -1)
  161. {
  162. num = num3;
  163. }
  164. num3 = num - num3;
  165. Vector3 position = child.position;
  166. this.m_aryBonePos[num3 * 3] = position.x;
  167. this.m_aryBonePos[num3 * 3 + 1] = position.y;
  168. this.m_aryBonePos[num3 * 3 + 2] = position.z;
  169. this.m_aryBoneTrs[num3] = child;
  170. this.m_listHookBoneTrs.Add(child);
  171. }
  172. num2--;
  173. }
  174. this.m_nHookBoneCount = this.m_listHookBoneTrs.Count;
  175. this.m_nBoneCount = this.m_nHookBoneCount;
  176. this.m_bOldBone = (this.m_nHookBoneCount <= 12);
  177. float num4 = 0f;
  178. for (int i = 0; i < this.m_nHookBoneCount; i++)
  179. {
  180. int num5 = 0;
  181. Transform transform = this.m_listHookBoneTrs[i];
  182. if (transform.localScale.x < 0.999f || 1.001f < transform.localScale.x || transform.localScale.y < 0.999f || 1.001f < transform.localScale.y || transform.localScale.z < 0.999f || 1.001f < transform.localScale.z)
  183. {
  184. this.m_listBoneScaleDef.Add(new BoneScaleDef(transform, transform.localPosition, transform.localRotation, transform.localScale));
  185. }
  186. this.m_aryBoneLength[i] = 0f;
  187. float num6 = 0f;
  188. while (transform.childCount > 0)
  189. {
  190. Vector3 position2 = transform.position;
  191. transform = transform.GetChild(0);
  192. if (transform.localScale.x < 0.999f || 1.001f < transform.localScale.x || transform.localScale.y < 0.999f || 1.001f < transform.localScale.y || transform.localScale.z < 0.999f || 1.001f < transform.localScale.z)
  193. {
  194. this.m_listBoneScaleDef.Add(new BoneScaleDef(transform, transform.localPosition, transform.localRotation, transform.localScale));
  195. }
  196. num6 += (position2 - transform.position).magnitude;
  197. Vector3 position3 = transform.position;
  198. this.m_aryBonePos[(num5 + 1) * (this.m_nHookBoneCount * 3) + i * 3] = position3.x;
  199. this.m_aryBonePos[(num5 + 1) * (this.m_nHookBoneCount * 3) + i * 3 + 1] = position3.y;
  200. this.m_aryBonePos[(num5 + 1) * (this.m_nHookBoneCount * 3) + i * 3 + 2] = position3.z;
  201. this.m_aryBoneTrs[(num5 + 1) * this.m_nHookBoneCount + i] = transform;
  202. this.m_aryBoneLength[(num5 + 1) * this.m_nHookBoneCount + i] = num6;
  203. this.m_nBoneCount++;
  204. num5++;
  205. }
  206. if (num4 < num6)
  207. {
  208. num4 = num6;
  209. }
  210. }
  211. this.m_fMaxLenght = num4;
  212. for (int j = 0; j < this.m_nBoneCount; j++)
  213. {
  214. this.m_aryBoneLengthRate[j] = this.m_aryBoneLength[j] / this.m_fMaxLenght;
  215. }
  216. this.m_aryVelocityForceRate = new float[this.m_nBoneCount];
  217. this.m_aryGravity = new float[this.m_nBoneCount * 3];
  218. this.m_trPanierParent = new GameObject("Skirt_P").transform;
  219. this.m_trPanierParent.SetParent(f_trSkirtRoot, false);
  220. this.m_trPanierParent.position = f_trSkirtRoot.position;
  221. this.m_trPanierParent.rotation = f_trSkirtRoot.rotation;
  222. this.m_aryPanierBoneTrs = new Transform[this.m_nBoneCount];
  223. this.m_aryPanierForce = new float[this.m_nBoneCount];
  224. this.m_aryPanierRadius = new float[this.m_nBoneCount];
  225. this.m_aryPanierBoneToLegSegRate = new float[this.m_nBoneCount];
  226. this.m_aryPanierBoneBeforeRotAngle = new float[this.m_nBoneCount];
  227. this.m_fPanierStress = new float[this.m_nHookBoneCount];
  228. this.m_fPanierVecAngle = new float[this.m_nHookBoneCount];
  229. this.m_aryPanierLastChildDef = new Transform[this.m_nHookBoneCount];
  230. Dictionary<string, ImportCM.OldSkirtBoneRev> dictionary = null;
  231. if (this.m_bOldBone)
  232. {
  233. dictionary = ImportCM.LoadOldSkirtBoneRev(f_objRoot.name);
  234. this.m_bPanierOldBoneRotRev = new bool[this.m_nBoneCount];
  235. this.m_vPanierOldBoneRotRevInit = new Vector3[this.m_nBoneCount];
  236. this.m_vPanierOldBoneRotRevAfter = new Vector3[this.m_nBoneCount];
  237. }
  238. int num7 = 0;
  239. for (int k = 0; k < this.m_nHookBoneCount; k++)
  240. {
  241. GameObject gameObject = new GameObject("Skirt_P_" + k + "_0");
  242. gameObject.transform.SetParent(this.m_trPanierParent, false);
  243. Transform transform2 = this.m_listHookBoneTrs[k];
  244. gameObject.transform.position = transform2.position;
  245. gameObject.transform.rotation = transform2.rotation;
  246. bool flag = false;
  247. Vector3 vector = Vector3.zero;
  248. Vector3 vector2 = Vector3.zero;
  249. if (this.m_bOldBone)
  250. {
  251. ImportCM.OldSkirtBoneRev oldSkirtBoneRev;
  252. if (dictionary != null && dictionary.TryGetValue(transform2.name, out oldSkirtBoneRev))
  253. {
  254. this.m_bPanierOldBoneRotRev[k] = true;
  255. this.m_vPanierOldBoneRotRevInit[k] = oldSkirtBoneRev.vRotRevInit;
  256. this.m_vPanierOldBoneRotRevAfter[k] = oldSkirtBoneRev.vRotRevAfter;
  257. flag = oldSkirtBoneRev.bRecursiv;
  258. if (flag)
  259. {
  260. vector = oldSkirtBoneRev.vRotRevInit;
  261. vector2 = oldSkirtBoneRev.vRotRevAfter;
  262. }
  263. }
  264. else
  265. {
  266. Vector3 normalized = (this.m_listHookBoneTrs[(k + 1 >= this.m_nHookBoneCount) ? 0 : (k + 1)].position - this.m_listHookBoneTrs[k].position).normalized;
  267. float num8 = Vector3.Dot(normalized, -this.m_listHookBoneTrs[k].forward);
  268. if (num8 < 0.1f)
  269. {
  270. this.m_bPanierOldBoneRotRev[k] = true;
  271. flag = true;
  272. float num9 = Vector3.Dot(normalized, this.m_listHookBoneTrs[k].forward);
  273. if (-0.1 < (double)num9 && num9 < 0.5f)
  274. {
  275. Vector3[] vPanierOldBoneRotRevInit = this.m_vPanierOldBoneRotRevInit;
  276. int num10 = k;
  277. vector = new Vector3(90f, 0f, 0f);
  278. vPanierOldBoneRotRevInit[num10] = vector;
  279. Vector3[] vPanierOldBoneRotRevAfter = this.m_vPanierOldBoneRotRevAfter;
  280. int num11 = k;
  281. vector2 = new Vector3(-90f, 0f, 0f);
  282. vPanierOldBoneRotRevAfter[num11] = vector2;
  283. }
  284. else
  285. {
  286. Vector3[] vPanierOldBoneRotRevInit2 = this.m_vPanierOldBoneRotRevInit;
  287. int num12 = k;
  288. vector = new Vector3(180f, 0f, 0f);
  289. vPanierOldBoneRotRevInit2[num12] = vector;
  290. Vector3[] vPanierOldBoneRotRevAfter2 = this.m_vPanierOldBoneRotRevAfter;
  291. int num13 = k;
  292. vector2 = new Vector3(-180f, 0f, 0f);
  293. vPanierOldBoneRotRevAfter2[num13] = vector2;
  294. }
  295. }
  296. }
  297. if (this.m_bPanierOldBoneRotRev[k])
  298. {
  299. gameObject.transform.Rotate(this.m_vPanierOldBoneRotRevInit[k], Space.Self);
  300. }
  301. }
  302. this.m_aryPanierBoneTrs[k] = gameObject.transform;
  303. int num14 = 0;
  304. int num15 = 0;
  305. Transform transform3 = this.m_listHookBoneTrs[k];
  306. while (transform3.childCount > 0)
  307. {
  308. transform3 = transform3.GetChild(0);
  309. int num16 = num15 * this.m_nHookBoneCount + k;
  310. int num17 = (num15 + 1) * this.m_nHookBoneCount + k;
  311. GameObject gameObject2 = new GameObject(string.Concat(new object[]
  312. {
  313. "Skirt_P_",
  314. k,
  315. "_",
  316. 1 + num15
  317. }));
  318. gameObject2.transform.SetParent(this.m_aryPanierBoneTrs[num16], false);
  319. gameObject2.transform.position = transform3.position;
  320. gameObject2.transform.rotation = transform3.rotation;
  321. if (this.m_bOldBone)
  322. {
  323. ImportCM.OldSkirtBoneRev oldSkirtBoneRev2;
  324. if (flag)
  325. {
  326. this.m_bPanierOldBoneRotRev[num17] = true;
  327. this.m_vPanierOldBoneRotRevInit[num17] = vector;
  328. this.m_vPanierOldBoneRotRevAfter[num17] = vector2;
  329. }
  330. else if (!flag && dictionary != null && dictionary.TryGetValue(transform2.name, out oldSkirtBoneRev2))
  331. {
  332. this.m_bPanierOldBoneRotRev[num17] = true;
  333. this.m_vPanierOldBoneRotRevInit[num17] = oldSkirtBoneRev2.vRotRevInit;
  334. this.m_vPanierOldBoneRotRevAfter[num17] = oldSkirtBoneRev2.vRotRevAfter;
  335. flag = oldSkirtBoneRev2.bRecursiv;
  336. if (flag)
  337. {
  338. vector = oldSkirtBoneRev2.vRotRevInit;
  339. vector2 = oldSkirtBoneRev2.vRotRevAfter;
  340. }
  341. }
  342. if (this.m_bPanierOldBoneRotRev[num17])
  343. {
  344. gameObject2.transform.Rotate(this.m_vPanierOldBoneRotRevInit[num17], Space.Self);
  345. }
  346. }
  347. this.m_aryPanierBoneTrs[num17] = gameObject2.transform;
  348. num15++;
  349. num14++;
  350. }
  351. if (num7 < num14)
  352. {
  353. num7 = num14;
  354. }
  355. }
  356. this.m_aryPanierBoneDefRot = new Quaternion[this.m_nBoneCount];
  357. for (int l = 0; l < this.m_nHookBoneCount; l++)
  358. {
  359. Transform transform4 = this.m_aryPanierBoneTrs[l];
  360. this.m_aryPanierBoneDefRot[l] = transform4.localRotation;
  361. int num18 = 0;
  362. while (transform4.childCount > 0)
  363. {
  364. transform4 = transform4.GetChild(0);
  365. this.m_aryPanierBoneDefRot[(num18 + 1) * this.m_nHookBoneCount + l] = transform4.localRotation;
  366. num18++;
  367. }
  368. }
  369. this.m_aryLegSeqRadius[0] = 0.1630143f;
  370. this.m_aryLegSeqRadius[1] = 0.2130143f;
  371. this.m_aryLegSeqRadius[2] = 0.5f;
  372. this.m_aryLegSeqRadius[3] = 0.5f;
  373. this.m_aryLegSeqRadius[4] = 0.5f;
  374. this.m_aryLegSeqRadius[5] = 0.5f;
  375. this.m_nPanierBoneCount = this.m_nBoneCount;
  376. for (int m = 0; m < this.m_nBoneCount * 3; m++)
  377. {
  378. this.m_aryPanierBonePos[m] = this.m_aryBonePos[m];
  379. }
  380. this.m_nBodyBallCount = 2;
  381. Transform pelvis = this.m_Body.Pelvis;
  382. int num19 = 0;
  383. GameObject gameObject3 = new GameObject("Hit_HipL");
  384. gameObject3.transform.SetParent(pelvis);
  385. this.m_listBodyBallPos.Add(gameObject3.transform);
  386. DynamicBoneCollider dynamicBoneCollider;
  387. this.m_listBodyBall.Add(dynamicBoneCollider = gameObject3.AddComponent<DynamicBoneCollider>());
  388. dynamicBoneCollider.m_Radius = 0.09f;
  389. gameObject3.transform.localPosition = new Vector3(-0.0181f, -0.0319f, 0.0573f);
  390. gameObject3.transform.localScale = new Vector3(1f, 1f, 1f);
  391. this.m_aryBodyBallPos[3 * num19] = gameObject3.transform.position.x;
  392. this.m_aryBodyBallPos[3 * num19 + 1] = gameObject3.transform.position.y;
  393. this.m_aryBodyBallPos[3 * num19 + 2] = gameObject3.transform.position.z;
  394. this.m_aryBodyBallRadius[num19] = dynamicBoneCollider.GetLossyScale();
  395. num19 = 1;
  396. GameObject gameObject4 = new GameObject("Hit_HipR");
  397. gameObject4.transform.SetParent(pelvis);
  398. this.m_listBodyBallPos.Add(gameObject4.transform);
  399. this.m_listBodyBall.Add(dynamicBoneCollider = gameObject4.AddComponent<DynamicBoneCollider>());
  400. dynamicBoneCollider.m_Radius = 0.09f;
  401. gameObject4.transform.localPosition = new Vector3(-0.0181f, -0.0319f, -0.0573f);
  402. gameObject4.transform.localScale = new Vector3(1f, 1f, 1f);
  403. this.m_aryBodyBallPos[3 * num19] = gameObject4.transform.position.x;
  404. this.m_aryBodyBallPos[3 * num19 + 1] = gameObject4.transform.position.y;
  405. this.m_aryBodyBallPos[3 * num19 + 2] = gameObject4.transform.position.z;
  406. this.m_aryBodyBallRadius[num19] = dynamicBoneCollider.GetLossyScale();
  407. GameObject gameObject5 = new GameObject("Hit_Vag");
  408. gameObject5.transform.SetParent(pelvis);
  409. this.m_listBodyBallPos.Add(gameObject5.transform);
  410. this.m_listBodyBall.Add(dynamicBoneCollider = gameObject5.AddComponent<DynamicBoneCollider>());
  411. dynamicBoneCollider.m_Radius = 0.09f;
  412. gameObject5.transform.localPosition = new Vector3(-0.022f, 0.023f, 0f);
  413. gameObject5.transform.localScale = new Vector3(1f, 1f, 1f);
  414. this.m_nBodyCapsuleCount = 4;
  415. this.m_aryCapsuleBoneTrs = new Transform[this.m_nBodyCapsuleCount * 2];
  416. this.m_aryCapsuleBoneTrs[0] = CMT.SearchObjName(this.m_Body.m_Bones.transform, "Bip01 L Thigh", true);
  417. this.m_aryCapsuleBoneTrs[1] = CMT.SearchObjName(this.m_Body.m_Bones.transform, "Bip01 L Calf", true);
  418. this.m_aryCapsuleBoneTrs[2] = this.m_aryCapsuleBoneTrs[1];
  419. this.m_aryCapsuleBoneTrs[3] = CMT.SearchObjName(this.m_Body.m_Bones.transform, "Bip01 L Foot", true);
  420. this.m_aryCapsuleBoneTrs[4] = CMT.SearchObjName(this.m_Body.m_Bones.transform, "Bip01 R Thigh", true);
  421. this.m_aryCapsuleBoneTrs[5] = CMT.SearchObjName(this.m_Body.m_Bones.transform, "Bip01 R Calf", true);
  422. this.m_aryCapsuleBoneTrs[6] = this.m_aryCapsuleBoneTrs[5];
  423. this.m_aryCapsuleBoneTrs[7] = CMT.SearchObjName(this.m_Body.m_Bones.transform, "Bip01 R Foot", true);
  424. this.m_aryTestCapsule = new Transform[this.m_nBodyCapsuleCount * 2];
  425. for (int n = 0; n < this.m_nBodyCapsuleCount; n++)
  426. {
  427. this.m_aryBodyCapsulePos[6 * n] = this.m_aryCapsuleBoneTrs[2 * n].position.x;
  428. this.m_aryBodyCapsulePos[6 * n + 1] = this.m_aryCapsuleBoneTrs[2 * n].position.y;
  429. this.m_aryBodyCapsulePos[6 * n + 2] = this.m_aryCapsuleBoneTrs[2 * n].position.z;
  430. this.m_aryBodyCapsulePos[6 * n + 3] = this.m_aryCapsuleBoneTrs[2 * n + 1].position.x;
  431. this.m_aryBodyCapsulePos[6 * n + 4] = this.m_aryCapsuleBoneTrs[2 * n + 1].position.y;
  432. this.m_aryBodyCapsulePos[6 * n + 5] = this.m_aryCapsuleBoneTrs[2 * n + 1].position.z;
  433. this.m_aryBodyCapsuleRadius[n] = this.m_fRegDefaultRadius;
  434. }
  435. Vector3 vector3 = this.m_Body.Pelvis.TransformPoint(new Vector3(-1f, 0f, 0f));
  436. this.m_vLegPelvisToSpine[0] = vector3.x;
  437. this.m_vLegPelvisToSpine[1] = vector3.y;
  438. this.m_vLegPelvisToSpine[2] = vector3.z;
  439. Vector3 vector4 = this.m_Body.Pelvis.TransformPoint(new Vector3(0f, 1f, 0f)) - this.m_Body.Pelvis.position;
  440. this.m_vLegPelvisToSpine[3] = vector4.x;
  441. this.m_vLegPelvisToSpine[4] = vector4.y;
  442. this.m_vLegPelvisToSpine[5] = vector4.z;
  443. this.m_aryLegSeqRadius[0] = this.m_fLegSeqRad0;
  444. this.m_aryLegSeqRadius[1] = this.m_fLegSeqRad1;
  445. this.m_aryLegSeqRadius[2] = this.m_fLegSeqRad1;
  446. this.m_aryLegSeqRadius[3] = this.m_fLegSeqRad2;
  447. this.m_aryLegSeqRadius[4] = this.m_fLegSeqRad2;
  448. this.m_aryLegSeqRadius[5] = this.m_fLegSeqRad3;
  449. this.UpdateParameters();
  450. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryBonePos, GCHandleType.Pinned));
  451. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryPanierBonePos, GCHandleType.Pinned));
  452. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryHookBonePos, GCHandleType.Pinned));
  453. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryBodyBallPos, GCHandleType.Pinned));
  454. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryBodyBallRadius, GCHandleType.Pinned));
  455. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryBodyCapsulePos, GCHandleType.Pinned));
  456. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryBodyCapsuleRadius, GCHandleType.Pinned));
  457. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryDebugLegSeqPos, GCHandleType.Pinned));
  458. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryLegSeqRadius, GCHandleType.Pinned));
  459. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_vLegPelvisToSpine, GCHandleType.Pinned));
  460. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryBoneParam, GCHandleType.Pinned));
  461. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryPanierForce, GCHandleType.Pinned));
  462. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryVelocityForceRate, GCHandleType.Pinned));
  463. this.m_listGcHandle.Add(GCHandle.Alloc(this.m_aryGravity, GCHandleType.Pinned));
  464. DynamicSkirtBone.m_dgExport_InitSkirt(this.m_nDllPhysicsInstanceID, this.m_aryHard[0], this.m_aryHard[1], this.m_aryHard[2], this.m_aryHard[3], this.m_aryBonePos, this.m_nBoneCount, this.m_nHookBoneCount, this.m_nBodyBallCount, this.m_aryBodyBallPos, this.m_aryBodyBallRadius, this.m_nBodyCapsuleCount, this.m_aryBodyCapsulePos, this.m_aryBodyCapsuleRadius, this.m_vLegPelvisToSpine, this.m_aryLegSeqRadius);
  465. return true;
  466. }
  467. public void OnPreFinalize()
  468. {
  469. if (DynamicSkirtBone.m_PluginDll != IntPtr.Zero)
  470. {
  471. if (this.m_nDllPhysicsInstanceID != -1)
  472. {
  473. DynamicSkirtBone.m_dgExport_PhysicsDelete(this.m_nDllPhysicsInstanceID);
  474. this.m_nDllPhysicsInstanceID = -1;
  475. }
  476. DynamicSkirtBone.FreeLibrary(DynamicSkirtBone.m_PluginDll);
  477. DynamicSkirtBone.m_PluginDll = IntPtr.Zero;
  478. }
  479. DynamicSkirtBone.m_dgExport_PhysicsCreate = null;
  480. DynamicSkirtBone.m_dgExport_PhysicsDelete = null;
  481. DynamicSkirtBone.m_dgExport_InitSkirt = null;
  482. DynamicSkirtBone.m_dgExport_GetBonePos = null;
  483. }
  484. private void OnDestroy()
  485. {
  486. this.Uninit();
  487. }
  488. private void OnValidate()
  489. {
  490. this.UpdateParameters();
  491. }
  492. public void Uninit()
  493. {
  494. if (this.m_nDllPhysicsInstanceID != -1)
  495. {
  496. if (DynamicSkirtBone.m_dgExport_PhysicsDelete != null)
  497. {
  498. DynamicSkirtBone.m_dgExport_PhysicsDelete(this.m_nDllPhysicsInstanceID);
  499. }
  500. this.m_nDllPhysicsInstanceID = -1;
  501. }
  502. foreach (Transform transform in this.m_listBodyBallPos)
  503. {
  504. UnityEngine.Object.Destroy(transform.gameObject);
  505. }
  506. this.m_listBodyBallPos.Clear();
  507. this.m_listBodyBall.Clear();
  508. for (int i = 0; i < this.m_listGcHandle.Count; i++)
  509. {
  510. GCHandle gchandle = this.m_listGcHandle[i];
  511. if (gchandle.IsAllocated)
  512. {
  513. gchandle.Free();
  514. }
  515. }
  516. this.m_listGcHandle.Clear();
  517. if (this.m_aryTestCapsule != null)
  518. {
  519. foreach (Transform transform2 in this.m_aryTestCapsule)
  520. {
  521. if (transform2 != null && transform2.gameObject != null)
  522. {
  523. UnityEngine.Object.DestroyImmediate(transform2.gameObject);
  524. }
  525. }
  526. this.m_aryTestCapsule = null;
  527. }
  528. }
  529. public void UpdateParameters()
  530. {
  531. bool flag = this.m_PanierRadiusDistrib != null && this.m_PanierRadiusDistrib.length != 0;
  532. bool flag2 = this.m_PanierForceDistrib != null && this.m_PanierForceDistrib.length != 0;
  533. bool flag3 = this.m_VelocityForceRateDistrib != null && this.m_VelocityForceRateDistrib.length != 0;
  534. bool flag4 = this.m_GravityDistrib != null && this.m_GravityDistrib.length != 0;
  535. int nH;
  536. for (nH = 0; nH < this.m_nHookBoneCount; nH++)
  537. {
  538. DynamicSkirtBone.PanierRadiusGroup panierRadiusGroup = null;
  539. if (this.m_PanierRadiusDistribGroup != null)
  540. {
  541. panierRadiusGroup = Array.Find<DynamicSkirtBone.PanierRadiusGroup>(this.m_PanierRadiusDistribGroup, (DynamicSkirtBone.PanierRadiusGroup a) => a.strBoneName == this.m_aryBoneTrs[nH].name);
  542. }
  543. int num = this.m_nBoneCount / this.m_nHookBoneCount;
  544. for (int i = 0; i < num; i++)
  545. {
  546. int num2 = i * this.m_nHookBoneCount + nH;
  547. float time = this.m_aryBoneLength[num2];
  548. if (panierRadiusGroup == null)
  549. {
  550. float num3 = this.m_fPanierRadius;
  551. if (flag)
  552. {
  553. num3 *= this.m_PanierRadiusDistrib.Evaluate(time);
  554. }
  555. this.m_aryPanierRadius[num2] = num3;
  556. }
  557. else
  558. {
  559. float num4 = panierRadiusGroup.fRadius;
  560. if (panierRadiusGroup.Curve != null && panierRadiusGroup.Curve.length != 0)
  561. {
  562. num4 *= panierRadiusGroup.Curve.Evaluate(time);
  563. }
  564. this.m_aryPanierRadius[num2] = num4;
  565. }
  566. float num5 = this.m_fPanierForce;
  567. if (flag2)
  568. {
  569. num5 *= this.m_PanierForceDistrib.Evaluate(time);
  570. }
  571. this.m_aryPanierForce[num2] = num5;
  572. float num6 = this.m_fVelocityForceRate;
  573. if (flag3)
  574. {
  575. num6 *= this.m_VelocityForceRateDistrib.Evaluate(time);
  576. }
  577. this.m_aryVelocityForceRate[num2] = num6;
  578. Vector3 a2 = this.m_vGravity;
  579. if (flag4)
  580. {
  581. a2 *= this.m_GravityDistrib.Evaluate(time);
  582. }
  583. this.m_aryGravity[num2 * 3] = a2.x;
  584. this.m_aryGravity[num2 * 3 + 1] = a2.y;
  585. this.m_aryGravity[num2 * 3 + 2] = a2.z;
  586. }
  587. }
  588. }
  589. public void UpdateSelf()
  590. {
  591. if (DynamicSkirtBone.m_dgExport_GetBonePos == null)
  592. {
  593. return;
  594. }
  595. if (this.m_listBoneScaleDef.Count != 0)
  596. {
  597. for (int i = 0; i < this.m_listBoneScaleDef.Count; i++)
  598. {
  599. BoneScaleDef boneScaleDef = this.m_listBoneScaleDef[i];
  600. boneScaleDef.trTarget.localScale = Vector3.one;
  601. }
  602. }
  603. Transform transform = this.m_aryCapsuleBoneTrs[0];
  604. Transform transform2 = this.m_aryCapsuleBoneTrs[1];
  605. Transform transform3 = this.m_aryCapsuleBoneTrs[4];
  606. Transform transform4 = this.m_aryCapsuleBoneTrs[5];
  607. Vector3 vector = transform.position;
  608. Vector3 vector2 = transform3.position;
  609. Vector3 position = transform2.position;
  610. Vector3 position2 = transform4.position;
  611. Plane plane = new Plane(vector, position2, position);
  612. bool flag;
  613. if (!plane.GetSide(vector2))
  614. {
  615. flag = false;
  616. float distanceToPoint = plane.GetDistanceToPoint(vector2);
  617. Vector3 vector3 = vector2 - plane.normal.normalized * distanceToPoint;
  618. vector2 = vector3;
  619. }
  620. else
  621. {
  622. Plane plane2 = new Plane(vector2, position2, position);
  623. flag = true;
  624. float distanceToPoint2 = plane2.GetDistanceToPoint(vector);
  625. Vector3 vector4 = vector - plane2.normal.normalized * distanceToPoint2;
  626. vector = vector4;
  627. }
  628. Vector3 a = transform2.position - vector;
  629. Vector3 a2 = transform4.position - vector2;
  630. int num = 1;
  631. int num2 = num * 2;
  632. Vector3 a3 = a * (1f / (float)num);
  633. Vector3 a4 = a2 * (1f / (float)num);
  634. if (this.m_aryLegSegPory == null || this.m_aryLegSegPory.Length != num2 * 3)
  635. {
  636. this.m_aryLegSegPory = new Vector3[num2 * 3];
  637. this.m_aryLegSegPoryVec = new Vector3[num2 * 2];
  638. this.m_aryLegSegPlane = new Plane[num2];
  639. }
  640. for (int j = 0; j < num; j++)
  641. {
  642. Vector3 vector5 = vector + a3 * (float)j;
  643. Vector3 vector6 = vector2 + a4 * (float)j;
  644. Vector3 vector7 = vector + a3 * (float)(j + 1);
  645. Vector3 vector8 = vector2 + a4 * (float)(j + 1);
  646. if (flag)
  647. {
  648. this.m_aryLegSegPory[6 * j] = vector5;
  649. this.m_aryLegSegPory[6 * j + 1] = vector6;
  650. this.m_aryLegSegPory[6 * j + 2] = vector7;
  651. this.m_aryLegSegPoryVec[4 * j] = vector6 - vector5;
  652. this.m_aryLegSegPoryVec[4 * j + 1] = vector7 - vector5;
  653. this.m_aryLegSegPlane[2 * j].Set3Points(vector7, vector6, vector5);
  654. this.m_aryLegSegPory[6 * j + 3] = vector6;
  655. this.m_aryLegSegPory[6 * j + 4] = vector8;
  656. this.m_aryLegSegPory[6 * j + 5] = vector7;
  657. this.m_aryLegSegPoryVec[4 * j + 2] = vector8 - vector6;
  658. this.m_aryLegSegPoryVec[4 * j + 3] = vector7 - vector6;
  659. this.m_aryLegSegPlane[2 * j + 1].Set3Points(vector7, vector8, vector6);
  660. }
  661. else
  662. {
  663. this.m_aryLegSegPory[6 * j] = vector5;
  664. this.m_aryLegSegPory[6 * j + 1] = vector6;
  665. this.m_aryLegSegPory[6 * j + 2] = vector8;
  666. this.m_aryLegSegPoryVec[4 * j] = vector6 - vector5;
  667. this.m_aryLegSegPoryVec[4 * j + 1] = vector8 - vector5;
  668. this.m_aryLegSegPlane[2 * j].Set3Points(vector8, vector6, vector5);
  669. this.m_aryLegSegPory[6 * j + 3] = vector5;
  670. this.m_aryLegSegPory[6 * j + 4] = vector8;
  671. this.m_aryLegSegPory[6 * j + 5] = vector7;
  672. this.m_aryLegSegPoryVec[4 * j + 2] = vector8 - vector5;
  673. this.m_aryLegSegPoryVec[4 * j + 3] = vector7 - vector5;
  674. this.m_aryLegSegPlane[2 * j + 1].Set3Points(vector7, vector8, vector5);
  675. }
  676. }
  677. float num3 = this.m_fRegDefaultRadius;
  678. TMorph morph = this.m_Body.goSlot[0].morph;
  679. float blendValues = morph.GetBlendValues(morph.BlendDataIdx_RegFat);
  680. float blendValues2 = morph.GetBlendValues(morph.BlendDataIdx_RegMeet);
  681. float num4 = (blendValues + blendValues2) * 0.5f;
  682. if (this.m_fRegFatThrethold <= num4)
  683. {
  684. num3 *= this.m_fRegFatRateMin + (this.m_fRegFatRateMax - this.m_fRegFatRateMin) * (num4 - this.m_fRegFatThrethold);
  685. }
  686. float num5 = 0f;
  687. this.m_fEasingScale = Mathf.SmoothDamp(this.m_fEasingScale, this.m_fScaleTo, ref num5, this.m_fScaleEaseSpeed);
  688. float num6 = 0f;
  689. for (int k = 0; k < this.m_nHookBoneCount; k++)
  690. {
  691. float num7 = 0f;
  692. float num8 = 0f;
  693. Transform transform5 = this.m_aryPanierBoneTrs[k];
  694. Transform transform6 = transform5;
  695. Vector3 position3 = transform6.position;
  696. Vector3 up = transform6.up;
  697. Transform transform7 = transform5;
  698. transform5.localRotation = this.m_aryPanierBoneDefRot[k];
  699. int num9 = k;
  700. int num10 = 0;
  701. Transform transform8 = transform5;
  702. while (transform8.childCount != 0)
  703. {
  704. int num11 = (num10 + 1) * this.m_nHookBoneCount + k;
  705. Transform transform9 = this.m_aryPanierBoneTrs[num11];
  706. transform9.localRotation = this.m_aryPanierBoneDefRot[num11];
  707. transform8 = (transform7 = transform9);
  708. num10++;
  709. }
  710. if (this.m_bEnableStressScale)
  711. {
  712. transform5.localScale = new Vector3(this.m_fEasingScale, this.m_fEasingScale, this.m_fEasingScale);
  713. this.m_aryBoneTrs[k].localScale = new Vector3(this.m_fEasingScale, this.m_fEasingScale, this.m_fEasingScale);
  714. }
  715. else
  716. {
  717. transform5.localScale = Vector3.one;
  718. this.m_aryBoneTrs[k].localScale = Vector3.one;
  719. }
  720. Vector3 vector9 = transform6.position + transform6.TransformVector(Vector3.right);
  721. this.m_fPanierVecAngle[k] = 0f;
  722. for (int l = 0; l < num2; l++)
  723. {
  724. float d = 0f;
  725. float distanceToPoint3 = this.m_aryLegSegPlane[l].GetDistanceToPoint(position3);
  726. if (-this.m_fAdjustRegSegPoly < distanceToPoint3 && distanceToPoint3 < this.m_fAdjustRegSegPoly)
  727. {
  728. Vector3 b;
  729. if (distanceToPoint3 < 0f)
  730. {
  731. b = this.m_aryLegSegPlane[l].normal * this.m_fAdjustRegSegPoly;
  732. }
  733. else
  734. {
  735. b = this.m_aryLegSegPlane[l].normal * -this.m_fAdjustRegSegPoly;
  736. }
  737. if (flag)
  738. {
  739. this.m_aryLegSegPory[l * 3] += b;
  740. this.m_aryLegSegPory[l * 3 + 1] += b;
  741. this.m_aryLegSegPory[l * 3 + 2] += b;
  742. this.m_aryLegSegPlane[l].Set3Points(this.m_aryLegSegPory[l * 3 + 2], this.m_aryLegSegPory[l * 3 + 1], this.m_aryLegSegPory[l * 3]);
  743. }
  744. else
  745. {
  746. this.m_aryLegSegPory[l * 3] += b;
  747. this.m_aryLegSegPory[l * 3 + 1] += b;
  748. this.m_aryLegSegPory[l * 3 + 2] += b;
  749. this.m_aryLegSegPlane[l].Set3Points(this.m_aryLegSegPory[l * 3 + 2], this.m_aryLegSegPory[l * 3 + 1], this.m_aryLegSegPory[l * 3]);
  750. }
  751. }
  752. Vector3 tvec = position3 - this.m_aryLegSegPory[l * 3];
  753. if (MathCM.TriangleLineIntersect(position3, vector9, tvec, this.m_aryLegSegPory[l * 3], this.m_aryLegSegPoryVec[l * 2], this.m_aryLegSegPoryVec[l * 2 + 1], ref d))
  754. {
  755. this.m_fPanierVecAngle[k] = 1f;
  756. Vector3 a5 = vector9;
  757. Vector3 b2 = (a5 - position3).normalized * d;
  758. Vector3 a6 = position3 + b2;
  759. transform6.Rotate(-Vector3.forward, 1f, Space.Self);
  760. float d2 = 0f;
  761. Vector3 a7 = position3 + transform6.TransformVector(Vector3.right);
  762. Vector3 direction = a7 - position3;
  763. if (this.m_aryLegSegPlane[l].Raycast(new Ray(position3, direction), out d2))
  764. {
  765. this.m_fPanierVecAngle[k] = 2f;
  766. Vector3 vector10 = position3 + direction.normalized * d2;
  767. Vector3 vector11 = a6 - vector10;
  768. Vector3 zero = Vector3.zero;
  769. if (MathCM.SphireRayIntersect(vector10 + vector11.normalized * 10f, -vector11.normalized, position3, (position3 - transform7.position).magnitude, ref zero))
  770. {
  771. this.m_fPanierVecAngle[k] = 3f;
  772. float num12 = Vector3.Angle(zero - position3, transform7.position - position3);
  773. transform6.Rotate(-Vector3.forward, num12 + 1f);
  774. num8 += num12 + 1f;
  775. break;
  776. }
  777. }
  778. }
  779. }
  780. num10 = 0;
  781. while (transform5.childCount != 0)
  782. {
  783. int num13 = (num10 + 1) * this.m_nHookBoneCount + k;
  784. Transform transform9 = this.m_aryPanierBoneTrs[num13];
  785. bool flag2 = false;
  786. float num14 = 10f;
  787. for (int m = 0; m < this.m_listBodyBall.Count; m++)
  788. {
  789. DynamicBoneCollider dynamicBoneCollider = this.m_listBodyBall[m] as DynamicBoneCollider;
  790. Transform transform10 = dynamicBoneCollider.transform;
  791. float lossyScale = dynamicBoneCollider.GetLossyScale();
  792. float num15 = this.m_aryPanierRadius[num13];
  793. Vector3 position4 = transform9.position;
  794. float magnitude = (transform10.position - transform9.position).magnitude;
  795. if (dynamicBoneCollider.Collide(ref position4, num15))
  796. {
  797. flag2 = true;
  798. for (float num16 = 0f; num16 < 360f; num16 += 1f)
  799. {
  800. transform5.Rotate(-Vector3.forward, 1f, Space.Self);
  801. position4 = transform9.position;
  802. num8 += 1f;
  803. magnitude = (transform10.position - transform9.position).magnitude;
  804. if (!dynamicBoneCollider.Collide(ref position4, num15))
  805. {
  806. break;
  807. }
  808. }
  809. }
  810. if (magnitude - (lossyScale + num15) < num14)
  811. {
  812. num14 = magnitude - (lossyScale + num15);
  813. }
  814. }
  815. bool flag3 = false;
  816. for (int n = 0; n < this.m_nBodyCapsuleCount; n++)
  817. {
  818. float num17 = this.m_fRegDefaultRadius;
  819. if (n == 0 || n == 2)
  820. {
  821. num17 = num3;
  822. }
  823. this.m_aryBodyCapsuleRadius[n] = num17;
  824. Transform transform11 = this.m_aryCapsuleBoneTrs[2 * n];
  825. Transform transform12 = this.m_aryCapsuleBoneTrs[2 * n + 1];
  826. MathCM.Segment segment = new MathCM.Segment(transform11.position, transform12.position);
  827. float num18 = this.m_aryPanierRadius[num13];
  828. Vector3 position5 = transform9.position;
  829. Vector3 vector12;
  830. float num20;
  831. float num19 = MathCM.calcPointSegmentDist(ref position5, ref segment, out vector12, out num20);
  832. if (num19 < num17 + num18)
  833. {
  834. flag2 = (flag3 = true);
  835. Vector3 position6 = transform5.position;
  836. float num21 = 0f;
  837. float num22;
  838. for (num22 = 0f; num22 < 360f; num22 += 1f)
  839. {
  840. transform5.Rotate(-Vector3.forward, 1f, Space.Self);
  841. position5 = transform9.position;
  842. num21 += 1f;
  843. num8 += 1f;
  844. if (MathCM.calcPointSegmentDist(ref position5, ref segment, out vector12, out num20) > num17 + num18)
  845. {
  846. this.m_aryPanierBoneBeforeRotAngle[num9] = num21;
  847. break;
  848. }
  849. }
  850. if (358f <= num22)
  851. {
  852. if (this.m_bGizmoDraw)
  853. {
  854. Debug.DrawLine(transform5.position, transform9.position, Color.red);
  855. }
  856. transform5.Rotate(-Vector3.forward, this.m_aryPanierBoneBeforeRotAngle[num9], Space.Self);
  857. }
  858. }
  859. if (num19 - (num17 + num18) < num14)
  860. {
  861. num14 = num19 - (num17 + num18);
  862. }
  863. }
  864. if (!flag3)
  865. {
  866. this.m_aryPanierBoneBeforeRotAngle[num9] = 0f;
  867. }
  868. if (!flag2)
  869. {
  870. float num23 = this.m_fPanierForce;
  871. if (this.m_PanierForceDistrib != null && this.m_PanierForceDistrib.length != 0)
  872. {
  873. num23 *= this.m_PanierForceDistrib.Evaluate(this.m_aryBoneLengthRate[num13]);
  874. }
  875. this.m_aryPanierForce[num13] = num23;
  876. if (0f < this.m_fPanierForceDistanceThreshold && num14 <= this.m_fPanierForceDistanceThreshold)
  877. {
  878. this.m_aryPanierForce[num13] += (1f - num23) * (1f - num14 / this.m_fPanierForceDistanceThreshold) * this.m_fPanierStressForce;
  879. }
  880. }
  881. else
  882. {
  883. this.m_aryPanierForce[num13] = 1f * this.m_fPanierStressForce;
  884. }
  885. num7 += num8;
  886. num8 = 0f;
  887. Quaternion quaternion = this.m_aryPanierBoneDefRot[num13];
  888. num9 = num13;
  889. transform5 = transform9;
  890. num10++;
  891. }
  892. if (this.m_bEnableLegSegHit)
  893. {
  894. for (int num24 = 0; num24 < num2; num24++)
  895. {
  896. float d3 = 0f;
  897. Vector3 tvec2 = position3 - this.m_aryLegSegPory[num24 * 3];
  898. if (MathCM.TriangleLineIntersect(position3, transform7.position, tvec2, this.m_aryLegSegPory[num24 * 3], this.m_aryLegSegPoryVec[num24 * 2], this.m_aryLegSegPoryVec[num24 * 2 + 1], ref d3))
  899. {
  900. Vector3 position7 = transform7.position;
  901. Vector3 b3 = (position7 - position3).normalized * d3;
  902. Vector3 a8 = position3 + b3;
  903. transform6.Rotate(-Vector3.forward, 1f, Space.Self);
  904. float d4 = 0f;
  905. Vector3 direction2 = transform7.position - position3;
  906. if (this.m_aryLegSegPlane[num24].Raycast(new Ray(position3, direction2), out d4))
  907. {
  908. Vector3 vector13 = position3 + direction2.normalized * d4;
  909. Vector3 vector14 = a8 - vector13;
  910. Vector3 zero2 = Vector3.zero;
  911. if (MathCM.SphireRayIntersect(vector13 - vector14.normalized * 10f, vector14.normalized, position3, (position3 - position7).magnitude, ref zero2))
  912. {
  913. float num25 = Vector3.Angle(zero2 - position3, position7 - position3);
  914. transform6.Rotate(-Vector3.forward, num25 + 1f);
  915. num7 += num25 + 1f;
  916. break;
  917. }
  918. }
  919. }
  920. }
  921. }
  922. this.m_fPanierStress[k] = num7;
  923. if (num6 < num7)
  924. {
  925. num6 = num7;
  926. }
  927. }
  928. if (this.m_fStressDgreeMin < num6)
  929. {
  930. float num26 = Mathf.Clamp(num6, this.m_fStressDgreeMin, this.m_fStressDgreeMax);
  931. this.m_fScaleTo = 1f - (1f - this.m_fStressMinScale) * ((num26 - this.m_fStressDgreeMin) / (this.m_fStressDgreeMax - this.m_fStressDgreeMin));
  932. }
  933. else
  934. {
  935. this.m_fScaleTo = 1f;
  936. }
  937. for (int num27 = 0; num27 < this.m_nHookBoneCount; num27++)
  938. {
  939. Vector3 position8 = this.m_listHookBoneTrs[num27].position;
  940. this.m_aryHookBonePos[3 * num27] = position8.x;
  941. this.m_aryHookBonePos[3 * num27 + 1] = position8.y;
  942. this.m_aryHookBonePos[3 * num27 + 2] = position8.z;
  943. }
  944. for (int num28 = 0; num28 < this.m_aryPanierBoneTrs.Length; num28++)
  945. {
  946. Transform transform13 = this.m_aryPanierBoneTrs[num28].transform;
  947. this.m_aryPanierBonePos[3 * num28] = transform13.position.x;
  948. this.m_aryPanierBonePos[3 * num28 + 1] = transform13.position.y;
  949. this.m_aryPanierBonePos[3 * num28 + 2] = transform13.position.z;
  950. }
  951. if (GameMain.Instance.VRMode)
  952. {
  953. Transform transform14 = GameMain.Instance.OvrMgr.GetVRControllerTransform(true).transform;
  954. Transform transform15 = GameMain.Instance.OvrMgr.GetVRControllerTransform(false).transform;
  955. AVRControllerButtons vrcontrollerButtons = GameMain.Instance.OvrMgr.GetVRControllerButtons(true);
  956. AVRControllerButtons vrcontrollerButtons2 = GameMain.Instance.OvrMgr.GetVRControllerButtons(false);
  957. Func<int, Transform, AVRControllerButtons, int> func = delegate(int grabIdx, Transform handTrans, AVRControllerButtons handBtns)
  958. {
  959. if (grabIdx == -1)
  960. {
  961. for (int num37 = 0; num37 < this.m_nHookBoneCount; num37++)
  962. {
  963. int num38 = this.m_nBoneCount / this.m_nHookBoneCount;
  964. for (int num39 = 0; num39 < num38; num39++)
  965. {
  966. int num40 = num37 + num39 * this.m_nHookBoneCount;
  967. Transform transform18 = this.m_aryBoneTrs[num40];
  968. if (handBtns.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_GRUB) && (transform18.position - handTrans.position).magnitude < 0.2f)
  969. {
  970. grabIdx = num40;
  971. break;
  972. }
  973. }
  974. }
  975. }
  976. else if (handBtns.GetPress(AVRControllerButtons.BTN.VIRTUAL_GRUB))
  977. {
  978. for (int num41 = grabIdx; num41 < this.m_nBoneCount; num41 += this.m_nHookBoneCount)
  979. {
  980. this.m_aryPanierForce[num41] = 0f;
  981. }
  982. Vector3 position9 = handTrans.position;
  983. this.m_aryPanierBonePos[3 * grabIdx] = position9.x;
  984. this.m_aryPanierBonePos[3 * grabIdx + 1] = position9.y;
  985. this.m_aryPanierBonePos[3 * grabIdx + 2] = position9.z;
  986. this.m_aryPanierForce[grabIdx] = 1f;
  987. Transform transform19 = this.m_aryBoneTrs[grabIdx];
  988. for (int num42 = 0; num42 < this.m_nHookBoneCount; num42++)
  989. {
  990. int num43 = this.m_nBoneCount / this.m_nHookBoneCount;
  991. for (int num44 = 0; num44 < num43; num44++)
  992. {
  993. int num45 = num42 + num44 * this.m_nHookBoneCount;
  994. if (grabIdx != num45)
  995. {
  996. Transform transform20 = this.m_aryBoneTrs[num45];
  997. float magnitude2 = (transform19.position - transform20.position).magnitude;
  998. if (magnitude2 <= 0.5f)
  999. {
  1000. this.m_aryPanierForce[num45] *= magnitude2 / 0.5f;
  1001. }
  1002. }
  1003. }
  1004. }
  1005. Debug.DrawLine(this.m_aryBoneTrs[grabIdx].position, this.m_aryBoneTrs[grabIdx].position + Vector3.up, Color.red);
  1006. }
  1007. else
  1008. {
  1009. grabIdx = -1;
  1010. }
  1011. return grabIdx;
  1012. };
  1013. this.m_nGrabIdxLeft = func(this.m_nGrabIdxLeft, transform14, vrcontrollerButtons);
  1014. this.m_nGrabIdxRight = func(this.m_nGrabIdxRight, transform15, vrcontrollerButtons2);
  1015. }
  1016. for (int num29 = 0; num29 < this.m_nBodyBallCount; num29++)
  1017. {
  1018. Transform transform16 = this.m_listBodyBallPos[num29];
  1019. this.m_aryBodyBallPos[3 * num29] = transform16.position.x;
  1020. this.m_aryBodyBallPos[3 * num29 + 1] = transform16.position.y;
  1021. this.m_aryBodyBallPos[3 * num29 + 2] = transform16.position.z;
  1022. }
  1023. for (int num30 = 0; num30 < this.m_nBodyCapsuleCount; num30++)
  1024. {
  1025. this.m_aryBodyCapsulePos[6 * num30] = this.m_aryCapsuleBoneTrs[2 * num30].position.x;
  1026. this.m_aryBodyCapsulePos[6 * num30 + 1] = this.m_aryCapsuleBoneTrs[2 * num30].position.y;
  1027. this.m_aryBodyCapsulePos[6 * num30 + 2] = this.m_aryCapsuleBoneTrs[2 * num30].position.z;
  1028. this.m_aryBodyCapsulePos[6 * num30 + 3] = this.m_aryCapsuleBoneTrs[2 * num30 + 1].position.x;
  1029. this.m_aryBodyCapsulePos[6 * num30 + 4] = this.m_aryCapsuleBoneTrs[2 * num30 + 1].position.y;
  1030. this.m_aryBodyCapsulePos[6 * num30 + 5] = this.m_aryCapsuleBoneTrs[2 * num30 + 1].position.z;
  1031. }
  1032. Vector3 vector15 = this.m_Body.Pelvis.TransformPoint(new Vector3(-1f, 0f, 0f));
  1033. this.m_vLegPelvisToSpine[0] = vector15.x;
  1034. this.m_vLegPelvisToSpine[1] = vector15.y;
  1035. this.m_vLegPelvisToSpine[2] = vector15.z;
  1036. Vector3 vector16 = this.m_Body.Pelvis.TransformPoint(new Vector3(0f, 1f, 0f)) - this.m_Body.Pelvis.position;
  1037. this.m_vLegPelvisToSpine[3] = vector16.x;
  1038. this.m_vLegPelvisToSpine[4] = vector16.y;
  1039. this.m_vLegPelvisToSpine[5] = vector16.z;
  1040. this.m_aryLegSeqRadius[0] = this.m_fLegSeqRad0;
  1041. this.m_aryLegSeqRadius[1] = this.m_fLegSeqRad1;
  1042. this.m_aryLegSeqRadius[2] = this.m_fLegSeqRad1;
  1043. this.m_aryLegSeqRadius[3] = this.m_fLegSeqRad2;
  1044. this.m_aryLegSeqRadius[4] = this.m_fLegSeqRad2;
  1045. this.m_aryLegSeqRadius[5] = this.m_fLegSeqRad3;
  1046. DynamicSkirtBone.m_dgExport_GetBonePos(this.m_nDllPhysicsInstanceID, this.m_nCalcTime, this.m_aryHookBonePos, this.m_nHookBoneCount, this.m_aryPanierBonePos, this.m_nPanierBoneCount, this.m_aryBonePos, this.m_nBoneCount, this.m_aryPanierForce, this.m_nBodyBallCount, this.m_aryBodyBallPos, this.m_nBodyCapsuleCount, this.m_aryBodyCapsulePos, this.m_aryBoneNormal, this.m_aryDebugLegSeqPos, this.m_aryLegSeqRadius, this.m_vLegPelvisToSpine, this.m_aryBoneParam, this.m_aryVelocityForceRate, this.m_aryGravity, this.m_aryHard, (!this.m_bResetPos) ? 0 : 1, this.m_Body.BoneHitHeightY + this.m_fFloorOffsetY);
  1047. for (int num31 = 0; num31 < this.m_nHookBoneCount; num31++)
  1048. {
  1049. int num32 = this.m_nBoneCount / this.m_nHookBoneCount;
  1050. for (int num33 = 0; num33 < num32; num33++)
  1051. {
  1052. int num34 = num31 + num33 * this.m_nHookBoneCount;
  1053. Vector3 vector17 = new Vector3(this.m_aryBonePos[3 * num34], this.m_aryBonePos[3 * num34 + 1], this.m_aryBonePos[3 * num34 + 2]);
  1054. Transform transform17 = this.m_aryBoneTrs[num34];
  1055. transform17.position = vector17;
  1056. if (num33 < num32 - 1)
  1057. {
  1058. int num35 = num31 + (num33 + 1) * this.m_nHookBoneCount;
  1059. Vector3 a9 = new Vector3(this.m_aryBonePos[3 * num35], this.m_aryBonePos[3 * num35 + 1], this.m_aryBonePos[3 * num35 + 2]);
  1060. Vector3 lhs = new Vector3(this.m_aryBoneNormal[3 * num34], this.m_aryBoneNormal[3 * num34 + 1], this.m_aryBoneNormal[3 * num34 + 2]);
  1061. Vector3 vector18 = a9 - vector17;
  1062. Vector3 vector19 = Vector3.Cross(lhs, vector18);
  1063. Quaternion rotation = Quaternion.AngleAxis(-90f, vector19);
  1064. vector18 = rotation * vector18;
  1065. transform17.rotation = Quaternion.LookRotation(vector19, vector18);
  1066. }
  1067. if (this.m_bOldBone && this.m_bPanierOldBoneRotRev[num34])
  1068. {
  1069. transform17.Rotate(this.m_vPanierOldBoneRotRevAfter[num34], Space.Self);
  1070. }
  1071. }
  1072. }
  1073. if (this.m_listBoneScaleDef.Count != 0)
  1074. {
  1075. for (int num36 = 0; num36 < this.m_listBoneScaleDef.Count; num36++)
  1076. {
  1077. BoneScaleDef boneScaleDef2 = this.m_listBoneScaleDef[num36];
  1078. boneScaleDef2.trTarget.localScale = boneScaleDef2.vDefScale;
  1079. }
  1080. }
  1081. this.m_bResetPos = false;
  1082. }
  1083. [Header("■パニエ ノードサイズ")]
  1084. public float m_fPanierRadius = 0.025f;
  1085. public AnimationCurve m_PanierRadiusDistrib;
  1086. public bool m_bPanierNodeGizmoDraw;
  1087. [Header("■パニエ ノードサイズの上書き")]
  1088. [SerializeField]
  1089. public DynamicSkirtBone.PanierRadiusGroup[] m_PanierRadiusDistribGroup;
  1090. [Header("■パニエ 力")]
  1091. [Range(0f, 1f)]
  1092. public float m_fPanierForce = 0.134f;
  1093. public AnimationCurve m_PanierForceDistrib;
  1094. public bool m_bPanierLineGizmoDraw;
  1095. [Header("■パニエ 重力適応割合(初期パニエノード回転から重力方向への力の割合)")]
  1096. [Range(0f, 1f)]
  1097. public float m_fPanierGravityRate;
  1098. [Header("■パニエ 当たっていない場合の戻る力")]
  1099. [Range(0f, 2f)]
  1100. public float m_fPanierStiffnessRate;
  1101. [Header("■パニエ 足に当っていた場合の強制パニエ力")]
  1102. [Range(0f, 1f)]
  1103. public float m_fPanierStressForce = 0.4f;
  1104. [Header("■パニエ 足との距離によるパニエ力")]
  1105. public float m_fPanierForceDistanceThreshold = 0.1f;
  1106. [Header("■パニエ 角度による全体のスケーリング")]
  1107. [Tooltip("水平方向に伸びて見えるのを防ぐ。")]
  1108. public bool m_bEnableStressScale = true;
  1109. public float m_fStressDgreeMin = 45f;
  1110. public float m_fStressDgreeMax = 90f;
  1111. public float m_fStressMinScale = 0.75f;
  1112. [ReadOnly]
  1113. public float m_fScaleTo = 1f;
  1114. [ReadOnly]
  1115. public float m_fEasingScale = 1f;
  1116. public float m_fScaleEaseSpeed = 5f;
  1117. [ReadOnly]
  1118. public float[] m_fPanierStress;
  1119. [ReadOnly]
  1120. public float[] m_fPanierVecAngle;
  1121. [Header("■パニエ 足の間の当たり判定")]
  1122. public bool m_bEnableLegSegHit = true;
  1123. public float m_fLegSegHitDgree = 45f;
  1124. [Header("■パニエ 足側カプセル初期半径")]
  1125. public float m_fRegDefaultRadius = 0.1f;
  1126. [Header("■パニエ 腿判定の足の太さによる補正 掛け算")]
  1127. public bool m_bEnableRegFatAndMeetAdjust = true;
  1128. public float m_fRegFatThrethold = 0.5f;
  1129. public float m_fRegFatRateMin = 1f;
  1130. public float m_fRegFatRateMax = 1.3f;
  1131. [Header("■パニエ 股間ポリゴン判定 親自体がポリゴンに近接している場合のポリゴン位置補正")]
  1132. public float m_fAdjustRegSegPoly = 0.005f;
  1133. [Header("■物理 計算回数")]
  1134. public int m_nCalcTime = 16;
  1135. [Header("■物理 惰性割合")]
  1136. public float m_fVelocityForceRate = 0.8f;
  1137. public AnimationCurve m_VelocityForceRateDistrib;
  1138. [Header("■物理 重力")]
  1139. public Vector3 m_vGravity = new Vector3(0f, -0.005f, 0f);
  1140. public AnimationCurve m_GravityDistrib;
  1141. [Header("■物理 繋がり力(横縮,横伸,縦縮,縦伸)(物理計算回数に依存)")]
  1142. public float[] m_aryHard = new float[]
  1143. {
  1144. 0f,
  1145. 0.01f,
  1146. 0f,
  1147. 0.7f
  1148. };
  1149. [Header("■物理 床判定オフセット")]
  1150. public float m_fFloorOffsetY = -0.03f;
  1151. public bool m_RealBoneAndNormalGizmoDraw = true;
  1152. [Header("")]
  1153. public float m_fLegSeqRad0 = 0.1f;
  1154. public float m_fLegSeqRad1 = 0.1f;
  1155. public float m_fLegSeqRad2 = 0.1f;
  1156. public float m_fLegSeqRad3 = 0.1f;
  1157. [Header("")]
  1158. public bool m_bGizmoDraw = true;
  1159. public bool m_bResetPos;
  1160. public const int SKIRT_W_MAX = 24;
  1161. public const int SKIRT_H_MAX = 48;
  1162. private Transform[] m_aryBoneTrs = new Transform[1152];
  1163. private float[] m_aryBonePos = new float[6144];
  1164. private int m_nBoneCount;
  1165. private int[] m_aryBoneParam = new int[2048];
  1166. private float[] m_aryBoneLength = new float[1152];
  1167. private float[] m_aryBoneLengthRate = new float[1152];
  1168. private float[] m_aryBoneNormal = new float[6144];
  1169. private Transform m_trPanierParent;
  1170. private float[] m_aryPanierBonePos = new float[6144];
  1171. private int m_nPanierBoneCount;
  1172. private Transform[] m_aryPanierBoneTrs;
  1173. private Transform[] m_aryPanierPanierBoneTrs;
  1174. private float[] m_aryPanierForce;
  1175. private Quaternion[] m_aryPanierBoneDefRot;
  1176. private float[] m_aryPanierBoneToLegSegRate;
  1177. private float[] m_aryPanierBoneBeforeRotAngle;
  1178. private bool[] m_bPanierOldBoneRotRev;
  1179. private Vector3[] m_vPanierOldBoneRotRevInit;
  1180. private Vector3[] m_vPanierOldBoneRotRevAfter;
  1181. private Transform[] m_aryPanierLastChildDef;
  1182. private float[] m_aryPanierRadius;
  1183. private float[] m_aryVelocityForceRate;
  1184. private float[] m_aryGravity;
  1185. private List<Transform> m_listHookBoneTrs;
  1186. private float[] m_aryHookBonePos = new float[6144];
  1187. private int m_nHookBoneCount;
  1188. private List<Transform> m_listBodyBallPos = new List<Transform>();
  1189. private float[] m_aryBodyBallPos = new float[6144];
  1190. private float[] m_aryBodyBallRadius = new float[2048];
  1191. private int m_nBodyBallCount;
  1192. public List<DynamicBoneColliderBase> m_listBodyBall = new List<DynamicBoneColliderBase>();
  1193. private Transform[] m_aryCapsuleBoneTrs;
  1194. private float[] m_aryBodyCapsulePos = new float[12288];
  1195. private float[] m_aryBodyCapsuleRadius = new float[2048];
  1196. private int m_nBodyCapsuleCount;
  1197. private float[] m_aryDebugLegSeqPos = new float[120];
  1198. private float[] m_vLegPelvisToSpine = new float[6];
  1199. private float[] m_aryLegSeqRadius = new float[20];
  1200. private TBody m_Body;
  1201. private TBodySkin m_BodySkin;
  1202. private Transform[] m_aryTestCapsule;
  1203. private List<BoneScaleDef> m_listBoneScaleDef = new List<BoneScaleDef>();
  1204. private bool m_bOldBone;
  1205. private const string kUseDllPath_x64 = "Plugins/";
  1206. private static IntPtr m_PluginDll = IntPtr.Zero;
  1207. private List<GCHandle> m_listGcHandle = new List<GCHandle>();
  1208. private int m_nDllPhysicsInstanceID = -1;
  1209. private static DynamicSkirtBone.Export_PhysicsCreate m_dgExport_PhysicsCreate = null;
  1210. private static DynamicSkirtBone.Export_PhysicsDelete m_dgExport_PhysicsDelete = null;
  1211. private static DynamicSkirtBone.Export_InitSkirt m_dgExport_InitSkirt = null;
  1212. private static DynamicSkirtBone.Export_GetBonePos m_dgExport_GetBonePos = null;
  1213. private GameObject m_point;
  1214. private GameObject m_capsule;
  1215. private float m_fMaxLenght;
  1216. private Vector3 m_testLineA;
  1217. private Transform m_testGoRay;
  1218. private Transform m_testGoTriA;
  1219. private Transform m_testGoTriB;
  1220. private Transform m_testGoTriC;
  1221. private Vector3[] m_aryLegSegPory;
  1222. private Vector3[] m_aryLegSegPoryVec;
  1223. private Plane[] m_aryLegSegPlane;
  1224. private int m_nGrabIdxLeft = -1;
  1225. private int m_nGrabIdxRight = -1;
  1226. private Vector3 m_vGrabPos = Vector3.zero;
  1227. private float m_grabDistance;
  1228. [Serializable]
  1229. public class PanierRadiusGroup
  1230. {
  1231. [SerializeField]
  1232. public string strBoneName;
  1233. [SerializeField]
  1234. public float fRadius;
  1235. [SerializeField]
  1236. public AnimationCurve Curve;
  1237. }
  1238. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  1239. private delegate int Export_PhysicsCreate();
  1240. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  1241. private delegate void Export_PhysicsDelete(int f_nID);
  1242. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  1243. private delegate void Export_InitSkirt(int f_nID, float f_fHardHShort, float f_fHardHLong, float f_HardVShort, float f_HardVLong, float[] f_aryBonePos, int f_nBoneCount, int f_nSWidth, int f_nBallCount, float[] f_aryBallPos, float[] f_aryBallRadius, int f_nCapsuleCount, float[] f_aryCapsulePos, float[] f_aryCapsuleRadius, float[] f_vLegPelvisToSpine, float[] f_aryLegSeqRadius);
  1244. [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
  1245. private delegate void Export_GetBonePos(int f_nID, int f_nCalcTime, float[] f_aryHookBonePos, int f_nHookBoneCount, float[] f_aryPanierBonePos, int f_nPanierBoneCount, float[] f_aryBonePos, int f_nBoneCount, float[] f_aryPanierForce, int f_nBallCount, float[] f_aryBallPos, int f_nCapsuleCount, float[] f_aryCapsulePos, float[] f_aryNodeNormal, float[] f_aryDebugLegSeqPos, float[] f_aryLegSeqRadius, float[] f_aryLegPelvisToSpine, int[] f_aryBoneParam, float[] f_aryVelocityForceRate, float[] f_aryGravity, float[] f_aryHard, int f_bReset, float f_fFloorY);
  1246. }