123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using RootMotion.FinalIK;
- using UnityEngine;
- using wf;
- public class OvrIK : MonoBehaviour
- {
- public OvrIK()
- {
- Quaternion[,] array = new Quaternion[4, 15];
- array[0, 0] = new Quaternion(1.379457E-08f, -1.907173E-10f, -0.1001217f, 0.9949752f);
- array[0, 1] = new Quaternion(-3.348364E-08f, -2.288052E-09f, -0.05697599f, 0.9983756f);
- array[0, 2] = new Quaternion(0.4853954f, -0.1902075f, 0.1155978f, 0.8454878f);
- array[0, 3] = new Quaternion(-2.555888E-09f, 1.190041E-09f, -0.08838178f, 0.9960867f);
- array[0, 4] = new Quaternion(-3.708266E-09f, -4.232382E-11f, -0.1423017f, 0.9898233f);
- array[0, 5] = new Quaternion(0.005196964f, -0.009313619f, -0.07643344f, 0.9970177f);
- array[0, 6] = new Quaternion(1.469708E-09f, -2.337872E-09f, -0.08838177f, 0.9960867f);
- array[0, 7] = new Quaternion(-4.677417E-09f, -1.311283E-08f, -0.1086997f, 0.9940746f);
- array[0, 8] = new Quaternion(-0.001879324f, -0.005337666f, -0.0991221f, 0.9950592f);
- array[0, 9] = new Quaternion(-8.490085E-09f, -1.805363E-09f, -0.0796621f, 0.9968219f);
- array[0, 10] = new Quaternion(2.300491E-09f, 3.334659E-09f, -0.1239805f, 0.9922847f);
- array[0, 11] = new Quaternion(-0.006921342f, 0.001893361f, -0.09829046f, 0.9951319f);
- array[0, 12] = new Quaternion(-5.701029E-09f, -1.521331E-09f, -0.05449884f, 0.9985139f);
- array[0, 13] = new Quaternion(3.803335E-09f, -5.725684E-09f, -0.1423017f, 0.9898233f);
- array[0, 14] = new Quaternion(-0.01357147f, 0.02850812f, -0.08513741f, 0.9958689f);
- array[1, 0] = new Quaternion(6.932151E-09f, -2.730647E-09f, -0.3665012f, 0.9304176f);
- array[1, 1] = new Quaternion(-1.952852E-08f, -2.699741E-08f, -0.1618618f, 0.9868135f);
- array[1, 2] = new Quaternion(0.7708589f, -0.2672266f, 0.03713043f, 0.577051f);
- array[1, 3] = new Quaternion(9.870518E-10f, 1.579613E-09f, -0.5299194f, 0.8480481f);
- array[1, 4] = new Quaternion(-5.034789E-09f, -5.799267E-09f, -0.8191521f, 0.5735765f);
- array[1, 5] = new Quaternion(0.0478053f, -0.01974053f, -0.5880075f, 0.8072003f);
- array[1, 6] = new Quaternion(8.812074E-09f, -1.401741E-08f, -0.5299194f, 0.8480481f);
- array[1, 7] = new Quaternion(-1.043265E-08f, 1.477225E-09f, -0.7992581f, 0.6009881f);
- array[1, 8] = new Quaternion(-0.009090314f, -0.01649067f, -0.6061373f, 0.7951371f);
- array[1, 9] = new Quaternion(-2.784401E-08f, 1.160059E-08f, -0.5224781f, 0.8526527f);
- array[1, 10] = new Quaternion(1.204624E-08f, 8.771129E-09f, -0.8084095f, 0.5886205f);
- array[1, 11] = new Quaternion(-0.04368013f, 0.007996441f, -0.6048046f, 0.7951349f);
- array[1, 12] = new Quaternion(-3.325827E-08f, 2.027481E-09f, -0.5008097f, 0.8655574f);
- array[1, 13] = new Quaternion(4.887594E-09f, -3.295959E-08f, -0.8191521f, 0.5735765f);
- array[1, 14] = new Quaternion(-0.09800828f, 0.05454942f, -0.591058f, 0.7987924f);
- array[2, 0] = new Quaternion(-1.299039E-08f, 7.939377E-10f, -0.08632442f, 0.9962671f);
- array[2, 1] = new Quaternion(-1.412307E-08f, -4.882294E-09f, -0.05340298f, 0.9985731f);
- array[2, 2] = new Quaternion(-0.4710969f, 0.1764064f, 0.1206711f, 0.8557962f);
- array[2, 3] = new Quaternion(-1.785701E-09f, -1.246846E-08f, -0.06366991f, 0.9979711f);
- array[2, 4] = new Quaternion(-5.778726E-11f, -1.242248E-08f, -0.1014653f, 0.9948391f);
- array[2, 5] = new Quaternion(-0.002611603f, 0.001185287f, -0.04763259f, 0.9988608f);
- array[2, 6] = new Quaternion(1.790176E-09f, -1.245129E-08f, -0.0636699f, 0.9979711f);
- array[2, 7] = new Quaternion(5.652268E-09f, 1.780454E-09f, -0.06771687f, 0.9977046f);
- array[2, 8] = new Quaternion(0.001466242f, 0.004677885f, -0.07036161f, 0.9975095f);
- array[2, 9] = new Quaternion(7.64029E-09f, 7.058498E-09f, -0.05493468f, 0.99849f);
- array[2, 10] = new Quaternion(-2.104634E-09f, -7.598384E-09f, -0.08305829f, 0.9965447f);
- array[2, 11] = new Quaternion(0.004817214f, 0.003811401f, -0.0695642f, 0.9975586f);
- array[2, 12] = new Quaternion(2.864904E-09f, -1.440215E-08f, -0.02973721f, 0.9995578f);
- array[2, 13] = new Quaternion(-7.071282E-10f, -5.241497E-09f, -0.1014653f, 0.9948391f);
- array[2, 14] = new Quaternion(0.00861063f, -0.01516612f, -0.05657673f, 0.998246f);
- array[3, 0] = new Quaternion(7.66758E-09f, -1.102812E-08f, -0.3665012f, 0.9304176f);
- array[3, 1] = new Quaternion(-8.709043E-09f, -7.065411E-09f, -0.1618618f, 0.9868135f);
- array[3, 2] = new Quaternion(-0.7708589f, 0.2672265f, 0.03713048f, 0.577051f);
- array[3, 3] = new Quaternion(-8.292553E-09f, 7.889813E-10f, -0.5299194f, 0.8480481f);
- array[3, 4] = new Quaternion(6.103158E-09f, 4.273478E-09f, -0.8191521f, 0.5735765f);
- array[3, 5] = new Quaternion(-0.0478053f, 0.01974053f, -0.5880075f, 0.8072003f);
- array[3, 6] = new Quaternion(-1.288366E-08f, 7.501511E-09f, -0.5299194f, 0.8480481f);
- array[3, 7] = new Quaternion(1.786481E-08f, 1.343313E-08f, -0.7992581f, 0.6009881f);
- array[3, 8] = new Quaternion(0.009090304f, 0.01649068f, -0.6061373f, 0.7951371f);
- array[3, 9] = new Quaternion(1.513849E-08f, -3.815058E-09f, -0.5224782f, 0.8526527f);
- array[3, 10] = new Quaternion(-1.643181E-08f, -2.748009E-09f, -0.8084095f, 0.5886205f);
- array[3, 11] = new Quaternion(0.04368011f, -0.007996418f, -0.6048046f, 0.7951349f);
- array[3, 12] = new Quaternion(1.196498E-08f, -9.074872E-09f, -0.5008097f, 0.8655574f);
- array[3, 13] = new Quaternion(-4.887593E-09f, 3.295959E-08f, -0.8191521f, 0.5735765f);
- array[3, 14] = new Quaternion(0.09800829f, -0.0545494f, -0.5910579f, 0.7987924f);
- this.m_aryHandRot = array;
- this.m_listDefaultPose = new List<KeyValuePair<Transform, Transform>>();
- this.m_vPelvisPosOffs = Vector3.zero;
- this.m_vPelvisRotOffs = Vector3.zero;
- this.m_listTrackerMeshRnder = new List<MeshRenderer>();
- this.m_fEyeToCamThresholdAngle = -0.9f;
- this.m_bEyeTocam = true;
- this.offsy = -0.06f;
- this.m_nShincho = -1;
- this.m_nDouPer = -1;
- this.m_nKubiScl = -1;
- base..ctor();
- }
- public static OvrIK Instance
- {
- get
- {
- return OvrIK.m_this;
- }
- }
- public static bool IsVRIKMode
- {
- get
- {
- return OvrIK.m_this != null && (OvrIK.IsModeVRIK || OvrIK.m_coCalibrate != null);
- }
- }
- public static bool IsModeVRIK { get; set; }
- private void DefaultPose()
- {
- string[] array = new string[]
- {
- "Bip01",
- "Bip01 Pelvis",
- "Bip01 Spine",
- "Bip01 Spine0a",
- "Bip01 Spine1",
- "Bip01 Spine1a",
- "Bip01 Neck",
- "Bip01 Head",
- "Bip01 L Clavicle",
- "Bip01 L UpperArm",
- "Bip01 L Forearm",
- "Bip01 L Hand",
- "Bip01 L Finger0",
- "Bip01 L Finger01",
- "Bip01 L Finger02",
- "Bip01 L Finger1",
- "Bip01 L Finger11",
- "Bip01 L Finger12",
- "Bip01 L Finger2",
- "Bip01 L Finger21",
- "Bip01 L Finger22",
- "Bip01 L Finger3",
- "Bip01 L Finger31",
- "Bip01 L Finger32",
- "Bip01 L Finger4",
- "Bip01 L Finger41",
- "Bip01 L Finger42",
- "Bip01 R Clavicle",
- "Bip01 R UpperArm",
- "Bip01 R Forearm",
- "Bip01 R Hand",
- "Bip01 R Finger0",
- "Bip01 R Finger01",
- "Bip01 R Finger02",
- "Bip01 R Finger1",
- "Bip01 R Finger11",
- "Bip01 R Finger12",
- "Bip01 R Finger2",
- "Bip01 R Finger21",
- "Bip01 R Finger22",
- "Bip01 R Finger3",
- "Bip01 R Finger31",
- "Bip01 R Finger32",
- "Bip01 R Finger4",
- "Bip01 R Finger41",
- "Bip01 R Finger42",
- "Bip01 L Thigh",
- "Bip01 L Calf",
- "Bip01 L Foot",
- "Bip01 L Toe2",
- "Bip01 L Toe21",
- "Bip01 L Toe1",
- "Bip01 L Toe11",
- "Bip01 L Toe0",
- "Bip01 L Toe01",
- "Bip01 R Thigh",
- "Bip01 R Calf",
- "Bip01 R Foot",
- "Bip01 R Toe2",
- "Bip01 R Toe21",
- "Bip01 R Toe1",
- "Bip01 R Toe11",
- "Bip01 R Toe0",
- "Bip01 R Toe01"
- };
- this.m_maid.body0.m_Bones.transform.position = Vector3.zero;
- this.m_maid.body0.m_Bones.transform.rotation = Quaternion.identity;
- foreach (string text in array)
- {
- Transform transform = CMT.SearchObjName(this.m_maid.body0.m_Bones2.transform, text, true);
- Transform transform2 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, text, true);
- if (transform != null && transform2 != null)
- {
- transform2.localRotation = transform.localRotation;
- if (text == "Bip01")
- {
- transform2.localPosition = transform.localPosition;
- }
- }
- }
- Transform transform3 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Thigh", true);
- transform3.localRotation = Quaternion.Euler(4.194572f, 175.3248f, -30.72415f);
- Transform transform4 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Calf", true);
- transform4.localRotation = Quaternion.Euler(-4.30072f, -1.857178f, 27.6982f);
- Transform transform5 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Thigh", true);
- transform5.localRotation = Quaternion.Euler(2.152464f, -178.752f, -30.914f);
- Transform transform6 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Calf", true);
- transform6.localRotation = Quaternion.Euler(-4.30072f, 1.857178f, 27.6982f);
- }
- public Maid NowMaid
- {
- get
- {
- return this.m_maid;
- }
- }
- public Transform EyeTargetTrs
- {
- get
- {
- return this.m_trEyeTarget;
- }
- }
- public bool EyeToCam
- {
- get
- {
- return this.m_bEyeTocam;
- }
- set
- {
- this.m_bEyeTocam = value;
- }
- }
- public static ControllerShortcutWindow CreateUI()
- {
- if (OvrIK.m_goVRIKConfigUI == null)
- {
- UnityEngine.Object original = Resources.Load("OVR/CircleCommandUI/Parent Controller Shortcut Setter Window");
- OvrIK.m_goVRIKConfigUI = (UnityEngine.Object.Instantiate(original) as GameObject);
- GameObject gameObject = GameObject.Find("SystemUI Root");
- OvrIK.m_goVRIKConfigUI.transform.SetParent(gameObject.transform, false);
- }
- if (OvrIK.m_VRIKConfigCompo == null)
- {
- OvrIK.m_VRIKConfigCompo = OvrIK.m_goVRIKConfigUI.GetComponent<ControllerShortcutWindow>();
- }
- return OvrIK.m_VRIKConfigCompo;
- }
- public static void InitStart()
- {
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
- if (maid != null)
- {
- OvrIK.m_this = maid.gameObject.GetComponent<OvrIK>();
- if (OvrIK.m_this == null)
- {
- OvrIK.m_this = maid.gameObject.AddComponent<OvrIK>();
- }
- if (!OvrIK.IsVRIKMode)
- {
- OvrIK.m_this.CalibrationStart();
- }
- }
- }
- public static void UninitEnd()
- {
- if (OvrIK.m_this != null)
- {
- OvrIK.m_this.Finish();
- }
- }
- public void CalibrationStart()
- {
- if (OvrIK.m_coCalibrate == null)
- {
- if (!this.Init())
- {
- return;
- }
- OvrIK.m_coCalibrate = base.StartCoroutine(this.CoCalibrate());
- }
- }
- private IEnumerator CoCalibrate()
- {
- yield return new WaitForSeconds(5f);
- this.Calibration();
- OvrIK.m_coCalibrate = null;
- yield break;
- }
- public void Finish()
- {
- if (OvrIK.m_coCalibrate != null)
- {
- base.StopCoroutine(OvrIK.m_coCalibrate);
- OvrIK.m_coCalibrate = null;
- }
- this.Uninit(true);
- }
- public void SelfShotCam()
- {
- if (this.m_coSelfShotCam != null)
- {
- this.m_coSelfShotCam.StartCountSnap();
- }
- }
- private void Uninit(bool bDestroyVRIKConfigUI = true)
- {
- OvrIK.IsModeVRIK = false;
- if (this.m_maid != null)
- {
- this.m_ik = this.m_maid.gameObject.GetComponent<VRIK>();
- if (this.m_ik != null)
- {
- UnityEngine.Object.Destroy(this.m_ik);
- Vector3 vector = GameMain.Instance.OvrMgr.OvrCamera.GetPos();
- vector += this.m_maid.transform.forward;
- GameMain.Instance.OvrMgr.OvrCamera.SetPos(vector);
- }
- this.m_ik = null;
- GameMain.Instance.OvrMgr.OvrCamera.HandVRIKMode = false;
- GameObject obj = this.m_maid.body0.GetSlot(1).obj;
- this.LayerCheck(obj, LayerMask.NameToLayer("Charactor"));
- GameObject obj2 = this.m_maid.body0.GetSlot(36).obj;
- this.LayerCheck(obj2, LayerMask.NameToLayer("Charactor"));
- GameObject obj3 = this.m_maid.body0.GetSlot(17).obj;
- this.LayerCheck(obj3, LayerMask.NameToLayer("Charactor"));
- Animation componentInChildren = this.m_maid.GetComponentInChildren<Animation>();
- if (componentInChildren != null)
- {
- componentInChildren.enabled = true;
- }
- if (this.m_aryBackAMTween != null)
- {
- foreach (AMTween amtween in this.m_aryBackAMTween)
- {
- if (amtween != null)
- {
- amtween.enabled = true;
- }
- }
- this.m_aryBackAMTween = null;
- }
- this.m_maid.boOffsetY = true;
- this.m_maid.SetMicLipSync(false);
- this.m_maid.SetPos(this.m_vBackPos);
- this.m_maid.SetRot(this.m_vBackRot);
- this.m_maid.body0.m_Bones.transform.localPosition = this.m_vBackRootPos;
- this.m_maid.body0.m_Bones.transform.localRotation = this.m_qBackRootRot;
- this.m_maid.SetAutoTwist(Maid.AutoTwist.ShoulderL, this.m_bBackAutoTwistShoulderL);
- this.m_maid.SetAutoTwist(Maid.AutoTwist.ShoulderR, this.m_bBackAutoTwistShoulderR);
- this.m_maid.SetAutoTwist(Maid.AutoTwist.WristL, this.m_bBackAutoTwistWristL);
- this.m_maid.SetAutoTwist(Maid.AutoTwist.WristR, this.m_bBackAutoTwistWristR);
- this.m_maid.SetAutoTwist(Maid.AutoTwist.ThighL, this.m_bBackAutoTwistThighL);
- this.m_maid.SetAutoTwist(Maid.AutoTwist.ThighR, this.m_bBackAutoTwistThighR);
- MaidColliderCollect.SuspendColliderAll(this.m_maid, true);
- this.m_maid.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
- this.m_maid = null;
- }
- this.m_listTrackerMeshRnder.Clear();
- this.m_listDefaultPose.Clear();
- if (this.m_goDefaultPoseParent != null)
- {
- UnityEngine.Object.Destroy(this.m_goDefaultPoseParent);
- }
- if (this.m_goIKTargetParent != null)
- {
- UnityEngine.Object.Destroy(this.m_goIKTargetParent);
- }
- if (this.m_trTargetOffsHead != null)
- {
- UnityEngine.Object.Destroy(this.m_trTargetOffsHead.gameObject);
- }
- if (this.m_trTargetOffsPelvis != null)
- {
- UnityEngine.Object.Destroy(this.m_trTargetOffsPelvis.gameObject);
- }
- if (this.m_trTargetOffsHandL != null)
- {
- UnityEngine.Object.Destroy(this.m_trTargetOffsHandL.gameObject);
- }
- if (this.m_trTargetOffsHandR != null)
- {
- UnityEngine.Object.Destroy(this.m_trTargetOffsHandR.gameObject);
- }
- if (this.m_trTargetOffsFootL != null)
- {
- UnityEngine.Object.Destroy(this.m_trTargetOffsFootL.gameObject);
- }
- if (this.m_trTargetOffsFootR != null)
- {
- UnityEngine.Object.Destroy(this.m_trTargetOffsFootR.gameObject);
- }
- if (this.m_trTargetOffsHeadTracker != null)
- {
- UnityEngine.Object.Destroy(this.m_trTargetOffsHeadTracker.gameObject);
- }
- if (this.m_self_shot_cam != null)
- {
- UnityEngine.Object.Destroy(this.m_self_shot_cam);
- }
- if (this.m_goMoni != null)
- {
- UnityEngine.Object.Destroy(this.m_goMoni);
- }
- if (this.m_FaceCompoL != null)
- {
- UnityEngine.Object.Destroy(this.m_FaceCompoL);
- }
- if (this.m_FaceCompoR != null)
- {
- UnityEngine.Object.Destroy(this.m_FaceCompoR);
- }
- if (this.m_coHandSignL != null)
- {
- UnityEngine.Object.Destroy(this.m_coHandSignL);
- }
- if (this.m_coHandSignR != null)
- {
- UnityEngine.Object.Destroy(this.m_coHandSignR);
- }
- if (this.m_coOtherCmdL != null)
- {
- UnityEngine.Object.Destroy(this.m_coOtherCmdL);
- }
- if (this.m_coOtherCmdR != null)
- {
- UnityEngine.Object.Destroy(this.m_coOtherCmdR);
- }
- if (bDestroyVRIKConfigUI && OvrIK.m_goVRIKConfigUI != null)
- {
- UnityEngine.Object.Destroy(OvrIK.m_goVRIKConfigUI);
- }
- GameMain.Instance.OvrMgr.OvrCamera.HandModelVisible = true;
- GameMain.Instance.OvrMgr.OvrCamera.SetCameraMask(CameraMain.CameraMask.OvrTouchLookObj, false);
- }
- private bool Init()
- {
- this.Uninit(false);
- this.m_maid = base.GetComponent<Maid>();
- NDebug.Assert(this.m_maid != null, "メイドが居ません。");
- if (!this.m_maid.Visible || this.m_maid.IsBusy || !this.m_maid.body0.isLoadedBody)
- {
- Debug.Log("OVRIK 未だメイドの準備ができていません。");
- return false;
- }
- Animation componentInChildren = this.m_maid.GetComponentInChildren<Animation>();
- componentInChildren.enabled = false;
- this.m_aryBackAMTween = this.m_maid.GetComponentsInChildren<AMTween>(true);
- if (this.m_aryBackAMTween != null)
- {
- foreach (AMTween amtween in this.m_aryBackAMTween)
- {
- if (amtween != null)
- {
- amtween.enabled = false;
- }
- }
- }
- this.m_bBackAutoTwistShoulderL = this.m_maid.body0.boAutoTwistShoulderL;
- this.m_bBackAutoTwistShoulderR = this.m_maid.body0.boAutoTwistShoulderR;
- this.m_bBackAutoTwistWristL = this.m_maid.body0.boAutoTwistWristL;
- this.m_bBackAutoTwistWristR = this.m_maid.body0.boAutoTwistWristR;
- this.m_bBackAutoTwistThighL = this.m_maid.body0.boAutoTwistThighL;
- this.m_bBackAutoTwistThighR = this.m_maid.body0.boAutoTwistThighR;
- this.m_maid.SetAutoTwistAll(true);
- this.m_vBackPos = this.m_maid.GetPos();
- this.m_vBackRot = this.m_maid.GetRot();
- this.m_vBackRootPos = this.m_maid.body0.m_Bones.transform.localPosition;
- this.m_qBackRootRot = this.m_maid.body0.m_Bones.transform.localRotation;
- this.m_maid.EyeToCamera(Maid.EyeMoveType.無し, 0f);
- this.m_maid.boOffsetY = false;
- this.DefaultPose();
- this.m_maid.SetPos(Vector3.zero);
- this.m_maid.SetRot(Vector3.zero);
- this.m_maid.SetMicLipSync(true);
- Transform transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Thigh", true);
- Quaternion localRotation = transform.localRotation;
- transform.localRotation = Quaternion.Euler(5.025288f, -179.97f, -9.849731f);
- Transform transform2 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Calf", true);
- Quaternion localRotation2 = transform2.localRotation;
- transform2.localRotation = Quaternion.Euler(-4.30072f, -1.857178f, 2.579935f);
- Transform transform3 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Thigh", true);
- Quaternion localRotation3 = transform3.localRotation;
- transform3.localRotation = Quaternion.Euler(5.025289f, -179.97f, -9.849731f);
- Transform transform4 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Calf", true);
- Quaternion localRotation4 = transform4.localRotation;
- transform4.localRotation = Quaternion.Euler(-4.30072f, 1.857178f, 2.579935f);
- Transform transform5 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Foot", true);
- this.m_maid.transform.position = new Vector3(0f, this.m_maid.transform.position.y - transform5.position.y + 0.13f, 0f);
- transform.localRotation = localRotation;
- transform2.localRotation = localRotation2;
- transform3.localRotation = localRotation3;
- transform4.localRotation = localRotation4;
- Transform t = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Hand", true);
- Transform t2 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Hand", true);
- this.m_trHandL = new Transform[this.m_strHandBoneNameL.Length];
- this.m_trHandR = new Transform[this.m_strHandBoneNameR.Length];
- for (int j = 0; j < this.m_strHandBoneNameL.Length; j++)
- {
- this.m_trHandL[j] = CMT.SearchObjName(t, this.m_strHandBoneNameL[j], true);
- this.m_trHandR[j] = CMT.SearchObjName(t2, this.m_strHandBoneNameR[j], true);
- }
- return true;
- }
- private void FindAndAddParent(Transform trChild, string f_strStopBone, bool f_bParentConnect = false)
- {
- if (trChild.name == f_strStopBone)
- {
- return;
- }
- GameObject gameObject = new GameObject(trChild.name);
- gameObject.transform.position = trChild.position;
- gameObject.transform.rotation = trChild.rotation;
- if (this.m_listDefaultPose.Count != 0 && f_bParentConnect)
- {
- this.m_listDefaultPose[this.m_listDefaultPose.Count - 1].Value.SetParent(gameObject.transform);
- }
- this.m_listDefaultPose.Add(new KeyValuePair<Transform, Transform>(trChild, gameObject.transform));
- if (trChild.parent != null)
- {
- this.FindAndAddParent(trChild.parent, f_strStopBone, true);
- }
- }
- private void LayerCheck(GameObject goParent, int nLayer)
- {
- if (goParent == null)
- {
- return;
- }
- try
- {
- for (int i = 0; i < goParent.transform.childCount; i++)
- {
- this.LayerCheck(goParent.transform.GetChild(i).gameObject, nLayer);
- }
- goParent.layer = nLayer;
- }
- catch (Exception message)
- {
- Debug.LogError(message);
- }
- }
- private void Calibration()
- {
- OvrIK.IsModeVRIK = true;
- MaidColliderCollect.SuspendColliderAll(this.m_maid, false);
- this.m_ik = this.m_maid.gameObject.GetComponent<VRIK>();
- if (this.m_ik == null)
- {
- this.m_ik = this.m_maid.gameObject.AddComponent<VRIK>();
- }
- OvrIK.m_conf = OvrIK.m_conf.Read();
- OvrIK.m_conf.Update(this.m_ik);
- this.m_fEyeToCamThresholdAngle = OvrIK.m_conf.m_fEyeToCamThresholdAngle;
- VRIK.References references = this.m_ik.references;
- string text = "Bip01";
- if (this.m_maid.boMAN)
- {
- text = "ManBip";
- }
- references.root = this.m_maid.body0.m_Bones.transform;
- references.pelvis = references.root.Find(text);
- references.spine = this.m_maid.body0.Spine;
- references.chest = this.m_maid.body0.Spine1a;
- references.neck = this.m_maid.body0.trsNeck;
- references.head = this.m_maid.body0.trsHead;
- references.leftShoulder = this.m_maid.body0.ClavicleL;
- references.leftUpperArm = this.m_maid.body0.UpperArmL;
- references.leftForearm = references.leftUpperArm.Find(text + " L Forearm");
- references.leftHand = references.leftForearm.Find(text + " L Hand");
- references.rightShoulder = this.m_maid.body0.ClavicleR;
- references.rightUpperArm = this.m_maid.body0.UpperArmR;
- references.rightForearm = references.rightUpperArm.Find(text + " R Forearm");
- references.rightHand = references.rightForearm.Find(text + " R Hand");
- references.leftThigh = this.m_maid.body0.Thigh_L;
- references.leftCalf = this.m_maid.body0.Calf_L;
- references.leftFoot = references.leftCalf.Find(text + " L Foot");
- references.rightThigh = this.m_maid.body0.Thigh_R;
- references.rightCalf = this.m_maid.body0.Calf_R;
- references.rightFoot = references.rightCalf.Find(text + " R Foot");
- this.m_ik.solver.leftLeg.positionWeight = 1f;
- this.m_ik.solver.leftLeg.rotationWeight = 1f;
- this.m_ik.solver.leftLeg.bendGoalWeight = 1f;
- this.m_ik.solver.rightLeg.positionWeight = 1f;
- this.m_ik.solver.rightLeg.rotationWeight = 1f;
- this.m_ik.solver.rightLeg.bendGoalWeight = 1f;
- this.m_ik.solver.plantFeet = false;
- if (this.m_goIKTargetParent != null)
- {
- UnityEngine.Object.Destroy(this.m_goIKTargetParent);
- }
- this.m_goIKTargetParent = new GameObject("VRIK Dummy Targets");
- Transform transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 Head", true);
- this.m_trTargetOffsHead = new GameObject("VRIK Target Offs Head").transform;
- this.m_trTargetOffsHead.position = transform.position;
- this.m_trTargetOffsHead.rotation = transform.rotation;
- this.m_trTargetOffsHead.SetParent(this.m_goIKTargetParent.transform, true);
- transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01", true);
- this.m_trTargetOffsPelvis = new GameObject("VRIK Target Offs Pelvis").transform;
- this.m_trTargetOffsPelvis.position = transform.position;
- this.m_trTargetOffsPelvis.rotation = transform.rotation;
- this.m_trTargetOffsPelvis.SetParent(this.m_goIKTargetParent.transform, true);
- transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Hand", true);
- this.m_trTargetOffsHandL = new GameObject("VRIK Target Offs Hand L").transform;
- this.m_trTargetOffsHandL.position = transform.position;
- this.m_trTargetOffsHandL.rotation = transform.rotation;
- this.m_trTargetOffsHandL.SetParent(this.m_goIKTargetParent.transform, true);
- transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Hand", true);
- this.m_trTargetOffsHandR = new GameObject("VRIK Target Offs Hand R").transform;
- this.m_trTargetOffsHandR.position = transform.position;
- this.m_trTargetOffsHandR.rotation = transform.rotation;
- this.m_trTargetOffsHandR.SetParent(this.m_goIKTargetParent.transform, true);
- this.m_ik.solver.spine.headTarget = this.m_trTargetOffsHead;
- this.m_ik.solver.spine.pelvisTarget = this.m_trTargetOffsPelvis;
- this.m_ik.solver.leftArm.target = this.m_trTargetOffsHandL;
- this.m_ik.solver.rightArm.target = this.m_trTargetOffsHandR;
- this.m_ik.solver.spine.pelvisPositionOffset = this.m_vPelvisPosOffs;
- this.m_ik.solver.spine.pelvisRotationOffset = Quaternion.Euler(this.m_vPelvisRotOffs);
- this.m_ik.solver.spine.pelvisPositionWeight = 0f;
- this.m_ik.solver.spine.headClampWeight = 0f;
- this.m_ik.solver.spine.chestRotationWeight = 0.3f;
- this.m_ik.solver.spine.chestClampWeight = 0.5f;
- transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Foot", true);
- this.m_trTargetOffsFootL = new GameObject("VRIK Target Offs Foot L").transform;
- this.m_trTargetOffsFootL.position = transform.position;
- this.m_trTargetOffsFootL.rotation = transform.rotation;
- this.m_trTargetOffsFootL.SetParent(this.m_goIKTargetParent.transform, true);
- transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Foot", true);
- this.m_trTargetOffsFootR = new GameObject("VRIK Target Offs Foot R").transform;
- this.m_trTargetOffsFootR.position = transform.position;
- this.m_trTargetOffsFootR.rotation = transform.rotation;
- this.m_trTargetOffsFootR.SetParent(this.m_goIKTargetParent.transform, true);
- this.m_ik.solver.leftLeg.target = this.m_trTargetOffsFootL;
- this.m_ik.solver.rightLeg.target = this.m_trTargetOffsFootR;
- this.m_ik.UpdateSolverExternal();
- Transform transform2 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Thigh", true);
- transform2.localRotation = Quaternion.Euler(5.025288f, -179.97f, -9.849731f);
- Transform transform3 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Calf", true);
- transform3.localRotation = Quaternion.Euler(-4.30072f, -1.857178f, 2.579935f);
- Transform transform4 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Thigh", true);
- transform4.localRotation = Quaternion.Euler(5.025289f, -179.97f, -9.849731f);
- Transform transform5 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Calf", true);
- transform5.localRotation = Quaternion.Euler(-4.30072f, 1.857178f, 2.579935f);
- this.m_listDefaultPose.Clear();
- if (this.m_goDefaultPoseParent != null)
- {
- UnityEngine.Object.Destroy(this.m_goDefaultPoseParent);
- }
- this.m_goDefaultPoseParent = new GameObject("VRIK Default Pose Parent");
- Transform transform6 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01", true).transform;
- this.FindAndAddParent(CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Foot", true).transform, "Bip01", false);
- GameObject gameObject = new GameObject(transform6.name);
- gameObject.transform.SetParent(this.m_goDefaultPoseParent.transform, false);
- gameObject.transform.position = transform6.position;
- gameObject.transform.rotation = transform6.rotation;
- this.m_listDefaultPose[this.m_listDefaultPose.Count - 1].Value.SetParent(gameObject.transform, true);
- this.m_listDefaultPose.Add(new KeyValuePair<Transform, Transform>(transform6, gameObject.transform));
- this.FindAndAddParent(CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Eyepos_R", false).transform, "Bip01", false);
- this.m_listDefaultPose[this.m_listDefaultPose.Count - 1].Value.SetParent(gameObject.transform, true);
- this.m_trMaidDefaultPoseEyeR = this.m_listDefaultPose.Find((KeyValuePair<Transform, Transform> a) => a.Key.name == "Eyepos_R").Value;
- this.m_trMaidDefaultPoseFootR = this.m_listDefaultPose.Find((KeyValuePair<Transform, Transform> a) => a.Key.name == "Bip01 R Foot").Value;
- GameMain.Instance.OvrMgr.OvrCamera.HandModelVisible = false;
- Transform hand_trans = GameMain.Instance.OvrMgr.ovr_obj.left_controller.hand_trans;
- Transform hand_trans2 = GameMain.Instance.OvrMgr.ovr_obj.right_controller.hand_trans;
- this.m_FaceCompoL = hand_trans.gameObject.GetComponent<PhotoFaceDataShortcutParent>();
- if (this.m_FaceCompoL == null)
- {
- this.m_FaceCompoL = hand_trans.gameObject.AddComponent<PhotoFaceDataShortcutParent>();
- }
- this.m_FaceCompoL.Init(true);
- this.m_FaceCompoL.isEnableHandUI = false;
- this.m_FaceCompoR = hand_trans2.gameObject.GetComponent<PhotoFaceDataShortcutParent>();
- if (this.m_FaceCompoR == null)
- {
- this.m_FaceCompoR = hand_trans2.gameObject.AddComponent<PhotoFaceDataShortcutParent>();
- }
- this.m_FaceCompoR.Init(false);
- this.m_FaceCompoR.isEnableHandUI = false;
- this.m_coHandSignL = hand_trans.gameObject.GetComponent<HandSignShortcut>();
- if (this.m_coHandSignL == null)
- {
- this.m_coHandSignL = hand_trans.gameObject.AddComponent<HandSignShortcut>();
- }
- this.m_coHandSignL.Init(true);
- this.m_coHandSignL.isEnableHandUI = false;
- this.m_coHandSignR = hand_trans2.gameObject.GetComponent<HandSignShortcut>();
- if (this.m_coHandSignR == null)
- {
- this.m_coHandSignR = hand_trans2.gameObject.AddComponent<HandSignShortcut>();
- }
- this.m_coHandSignR.Init(false);
- this.m_coHandSignR.isEnableHandUI = false;
- this.m_coOtherCmdL = hand_trans.gameObject.GetComponent<OtherCommandShortcut>();
- if (this.m_coOtherCmdL == null)
- {
- this.m_coOtherCmdL = hand_trans.gameObject.AddComponent<OtherCommandShortcut>();
- }
- this.m_coOtherCmdL.Init(true);
- this.m_coOtherCmdL.isEnableHandUI = false;
- this.m_coOtherCmdR = hand_trans2.gameObject.GetComponent<OtherCommandShortcut>();
- if (this.m_coOtherCmdR == null)
- {
- this.m_coOtherCmdR = hand_trans2.gameObject.AddComponent<OtherCommandShortcut>();
- }
- this.m_coOtherCmdR.Init(false);
- this.m_coOtherCmdR.isEnableHandUI = false;
- if (OvrIK.m_goVRIKConfigUI == null)
- {
- UnityEngine.Object original = Resources.Load("OVR/CircleCommandUI/Parent Controller Shortcut Setter Window");
- OvrIK.m_goVRIKConfigUI = (UnityEngine.Object.Instantiate(original) as GameObject);
- GameObject gameObject2 = GameObject.Find("SystemUI Root");
- OvrIK.m_goVRIKConfigUI.transform.SetParent(gameObject2.transform, false);
- }
- if (OvrIK.m_VRIKConfigCompo == null)
- {
- OvrIK.m_VRIKConfigCompo = OvrIK.m_goVRIKConfigUI.GetComponent<ControllerShortcutWindow>();
- }
- OvrIK.m_VRIKConfigCompo.Init(this.m_FaceCompoR, this.m_FaceCompoL);
- OvrIK.m_VRIKConfigCompo.Open();
- GameMain.Instance.OvrMgr.OvrCamera.HandVRIKMode = true;
- if (this.m_ik == null)
- {
- Debug.LogError("未だVRIKが付いていません。");
- return;
- }
- this.m_maid = base.GetComponent<Maid>();
- NDebug.Assert(this.m_maid != null, "メイドが居ません。");
- this.m_maid.boOffsetY = false;
- GameObject obj = this.m_maid.body0.GetSlot(1).obj;
- this.LayerCheck(obj, LayerMask.NameToLayer("Face"));
- GameObject obj2 = this.m_maid.body0.GetSlot(36).obj;
- this.LayerCheck(obj2, LayerMask.NameToLayer("Face"));
- GameObject obj3 = this.m_maid.body0.GetSlot(17).obj;
- this.LayerCheck(obj3, LayerMask.NameToLayer("Face"));
- GameMain.Instance.OvrMgr.OvrCamera.SetCameraMask((CameraMain.CameraMask)LayerMask.NameToLayer("Face"), false);
- Transform transform7 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Eyepos_L", false);
- Transform transform8 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Eyepos_R", false);
- Vector3 vector = transform8.position + (transform7.position - transform8.position) * 0.5f;
- this.m_trPlayerDefaultPoseEye = new GameObject("Pair Player Eye").transform;
- this.m_trPlayerDefaultPoseEye.SetParent(this.m_goDefaultPoseParent.transform, false);
- this.m_trPlayerDefaultPoseEye.position = vector;
- GameMain.Instance.OvrMgr.OvrCamera.SetRealHeadPos(vector, false);
- GameMain.Instance.OvrMgr.OvrCamera.SetRealHeadRot(new Vector3(0f, 0f, 0f), true);
- Transform realHeadTransform = GameMain.Instance.OvrMgr.OvrCamera.GetRealHeadTransform();
- Transform hand_trans3 = GameMain.Instance.OvrMgr.ovr_obj.left_controller.hand_trans;
- Transform hand_trans4 = GameMain.Instance.OvrMgr.ovr_obj.right_controller.hand_trans;
- this.m_trTargetOffsHead.SetParent(realHeadTransform, false);
- this.m_trTargetOffsHead.localPosition = new Vector3(0f, -0.03f, -0.05f);
- this.m_trTargetOffsHead.localRotation = Quaternion.Euler(0f, -90f, -90f);
- this.m_trTargetOffsHandL.SetParent(hand_trans3, false);
- this.m_trTargetOffsHandL.localPosition = new Vector3(-0.014f, -0.032f, -0.106f);
- this.m_trTargetOffsHandL.localRotation = Quaternion.Euler(74.50851f, -128.3506f, 135.9052f);
- this.m_trTargetOffsHandR.SetParent(hand_trans4, false);
- this.m_trTargetOffsHandR.localPosition = new Vector3(0.014f, -0.032f, -0.106f);
- this.m_trTargetOffsHandR.localRotation = Quaternion.Euler(-83.64291f, 34.33916f, 46.03844f);
- this.m_ik.solver.spine.headTarget = this.m_trTargetOffsHead;
- this.m_ik.solver.leftArm.target = this.m_trTargetOffsHandL;
- this.m_ik.solver.rightArm.target = this.m_trTargetOffsHandR;
- AVRTrackingObjectsMgr trackingObjectsMgr = GameMain.Instance.OvrMgr.TrackingObjectsMgr;
- if (trackingObjectsMgr != null)
- {
- trackingObjectsMgr.Refresh();
- List<Transform> trackingObjects = trackingObjectsMgr.TrackingObjects;
- bool use1TrackerForHead = ControllerShortcutSettingData.config.use1TrackerForHead;
- int index = 0;
- int index2 = 1;
- int index3 = 2;
- int num = 2;
- int num2 = 3;
- if (use1TrackerForHead && 1 <= trackingObjects.Count)
- {
- Debug.Log("OvrIK トラッカーが1つ見つかりました。ヘッドトラッキングに使えます。");
- trackingObjects.Sort((Transform a, Transform b) => (b.transform.position.y - a.transform.position.y >= 0f) ? 1 : -1);
- Transform transform9 = trackingObjects[0];
- this.m_listTrackerMeshRnder.Add(transform9.GetComponent<MeshRenderer>());
- Transform transform10 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 Head", true);
- this.m_trTargetOffsHeadTracker = new GameObject("VRIK Target Offs Head Tracker").transform;
- this.m_trTargetOffsHeadTracker.position = transform10.position;
- this.m_trTargetOffsHeadTracker.rotation = transform10.rotation;
- this.m_trTargetOffsHeadTracker.SetParent(transform9, true);
- this.m_ik.solver.spine.headTarget = this.m_trTargetOffsHeadTracker;
- trackingObjects.Remove(transform);
- this.CheckHeadIsTracker();
- }
- if (num <= trackingObjects.Count)
- {
- trackingObjects.Sort((Transform a, Transform b) => (a.transform.position.y - b.transform.position.y >= 0f) ? 1 : -1);
- if (hand_trans3.position.y < trackingObjects[index].position.y || hand_trans3.position.y < trackingObjects[index2].position.y)
- {
- Debug.LogError("足のトラッカーは手より下になければなりません。");
- }
- if ((trackingObjects[index].position - trackingObjects[index2].position).magnitude < 0.1f)
- {
- Debug.LogError("足は10cm以上広げて下さい。");
- }
- Transform transform11;
- Transform transform12;
- if ((hand_trans3.position - trackingObjects[index].position).sqrMagnitude < (hand_trans3.position - trackingObjects[index2].position).sqrMagnitude)
- {
- transform11 = trackingObjects[index];
- transform12 = trackingObjects[index2];
- }
- else
- {
- transform11 = trackingObjects[index2];
- transform12 = trackingObjects[index];
- }
- this.m_listTrackerMeshRnder.Add(transform11.GetComponent<MeshRenderer>());
- this.m_listTrackerMeshRnder.Add(transform12.GetComponent<MeshRenderer>());
- this.m_ik.solver.spine.pelvisPositionOffset = this.m_vPelvisPosOffs;
- this.m_ik.solver.spine.pelvisRotationOffset = Quaternion.Euler(this.m_vPelvisRotOffs);
- this.m_ik.solver.spine.pelvisPositionWeight = 0f;
- this.m_ik.solver.spine.headClampWeight = 0f;
- this.m_ik.solver.spine.chestRotationWeight = 0.3f;
- this.m_ik.solver.spine.chestClampWeight = 0.5f;
- transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 L Foot", true);
- this.m_trTargetOffsFootL.position = transform.position;
- this.m_trTargetOffsFootL.rotation = transform.rotation;
- this.m_trTargetOffsFootL.SetParent(transform11, true);
- this.m_vFootDefOffsLocalL = this.m_trTargetOffsFootL.localPosition;
- this.m_trTargetOffsFootLVecY = new GameObject("Y Vec").transform;
- this.m_trTargetOffsFootLVecY.SetParent(this.m_trTargetOffsFootL, false);
- this.m_trTargetOffsFootLVecY.localPosition = Vector3.zero;
- this.m_trTargetOffsFootLVecY.position += new Vector3(0f, -1f, 0f);
- transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 R Foot", true);
- this.m_trTargetOffsFootR.position = transform.position;
- this.m_trTargetOffsFootR.rotation = transform.rotation;
- this.m_trTargetOffsFootR.SetParent(transform12, true);
- this.m_vFootDefOffsLocalR = this.m_trTargetOffsFootR.localPosition;
- this.m_trTargetOffsFootRVecY = new GameObject("Y Vec").transform;
- this.m_trTargetOffsFootRVecY.SetParent(this.m_trTargetOffsFootR, false);
- this.m_trTargetOffsFootRVecY.localPosition = Vector3.zero;
- this.m_trTargetOffsFootRVecY.position += new Vector3(0f, -1f, 0f);
- this.m_ik.solver.leftLeg.target = this.m_trTargetOffsFootL;
- this.m_ik.solver.rightLeg.target = this.m_trTargetOffsFootR;
- this.m_trPlayerDefaultPoseFoot = new GameObject("Pair Player Foot").transform;
- this.m_trPlayerDefaultPoseFoot.SetParent(this.m_trPlayerDefaultPoseEye, false);
- this.m_trPlayerDefaultPoseFoot.position = this.m_trTargetOffsFootL.position + (this.m_trTargetOffsFootR.position - this.m_trTargetOffsFootL.position) * 0.5f;
- this.m_ik.solver.spine.pelvisTarget = null;
- if (num2 <= trackingObjects.Count)
- {
- Transform transform13 = trackingObjects[index3];
- this.m_listTrackerMeshRnder.Add(transform13.GetComponent<MeshRenderer>());
- if (transform13.position.y >= hand_trans3.position.y)
- {
- Debug.LogError("腰は頭より下でなければなりません。");
- }
- if (transform13.position.y <= transform11.position.y || transform13.position.y <= transform12.position.y)
- {
- Debug.LogError("腰は両足より上でなければなりません。");
- }
- transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01", true);
- this.m_trTargetOffsPelvis.position = transform.position;
- this.m_trTargetOffsPelvis.rotation = transform.rotation;
- this.m_trTargetOffsPelvis.SetParent(transform13, true);
- float num3 = realHeadTransform.transform.position.y - (transform13.position.y - 0.2f);
- Transform transform14 = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, "Bip01 Pelvis", true);
- float num4 = vector.y - transform14.transform.position.y;
- float num5 = num4 - num3;
- this.m_ik.solver.spine.pelvisTarget = this.m_trTargetOffsPelvis;
- this.m_ik.solver.spine.pelvisPositionWeight = 1f;
- }
- this.m_bLegTracking = true;
- }
- else
- {
- Debug.Log("OvrIK トラッカーは" + num + "つ未満です。足のトラッキングは行いません。");
- this.m_bLegTracking = false;
- }
- }
- if (!this.m_bLegTracking)
- {
- this.m_ik.solver.leftLeg.rotationWeight = (this.m_ik.solver.rightLeg.rotationWeight = OvrIK.m_conf.leg_no_tracker_rot_weight);
- this.m_ik.solver.leftLeg.positionWeight = (this.m_ik.solver.rightLeg.positionWeight = OvrIK.m_conf.leg_no_tracker_pos_weight);
- }
- this.m_self_shot_cam = GameObject.Find("OvrSelfShotCamera");
- if (this.m_self_shot_cam == null)
- {
- this.m_coSelfShotCam = OvrSelfShotCamera.Create();
- this.m_self_shot_cam = this.m_coSelfShotCam.gameObject;
- this.m_trEyeTarget = this.m_coSelfShotCam.EyeTarget;
- this.m_rtMoniPlaneTex = this.m_coSelfShotCam.CamTex;
- }
- this.m_goMoni = GameObject.Find("OvrIKPlaneCamera");
- if (!this.m_goMoni)
- {
- this.m_goMoni = Utility.CreatePrefab(null, "OVR/OvrIKPlaneCamera", false);
- this.m_goMoni.name = "OvrIKPlaneCamera";
- this.m_trMoniPlane = this.m_goMoni.transform.Find("Plane").transform;
- }
- this.m_maid.EyeToCamera(Maid.EyeMoveType.目だけ向ける, 0f);
- }
- private void ReCalcShincho()
- {
- if (this.m_trMaidDefaultPoseEyeR == null || this.m_trPlayerDefaultPoseEye == null || this.m_trMaidDefaultPoseFootR == null || this.m_trPlayerDefaultPoseFoot == null || this.m_trTargetOffsFootL == null || this.m_trTargetOffsFootR == null)
- {
- return;
- }
- float num = this.m_trMaidDefaultPoseEyeR.position.y - this.m_trMaidDefaultPoseFootR.position.y;
- float num2 = this.m_trPlayerDefaultPoseEye.position.y - this.m_trPlayerDefaultPoseFoot.position.y;
- float d = num - num2 + this.offsy;
- this.m_trTargetOffsFootL.localPosition = this.m_vFootDefOffsLocalL;
- this.m_trTargetOffsFootR.localPosition = this.m_vFootDefOffsLocalR;
- this.m_trTargetOffsFootL.position += (this.m_trTargetOffsFootLVecY.position - this.m_trTargetOffsFootL.position).normalized * d;
- this.m_trTargetOffsFootR.position += (this.m_trTargetOffsFootRVecY.position - this.m_trTargetOffsFootR.position).normalized * d;
- }
- private void CheckHeadIsTracker()
- {
- bool flag = this.m_ik.solver.spine.headTarget == this.m_trTargetOffsHeadTracker;
- if (flag != this.m_isHeadIsTracker)
- {
- if (flag)
- {
- GameObject obj = this.m_maid.body0.GetSlot(1).obj;
- this.LayerCheck(obj, LayerMask.NameToLayer("Charactor"));
- GameObject obj2 = this.m_maid.body0.GetSlot(36).obj;
- this.LayerCheck(obj2, LayerMask.NameToLayer("Charactor"));
- GameObject obj3 = this.m_maid.body0.GetSlot(17).obj;
- this.LayerCheck(obj3, LayerMask.NameToLayer("Charactor"));
- }
- else
- {
- GameObject obj4 = this.m_maid.body0.GetSlot(1).obj;
- this.LayerCheck(obj4, LayerMask.NameToLayer("Face"));
- GameObject obj5 = this.m_maid.body0.GetSlot(36).obj;
- this.LayerCheck(obj5, LayerMask.NameToLayer("Face"));
- GameObject obj6 = this.m_maid.body0.GetSlot(17).obj;
- this.LayerCheck(obj6, LayerMask.NameToLayer("Face"));
- }
- this.m_isHeadIsTracker = flag;
- }
- }
- private void OnDisable()
- {
- this.Finish();
- }
- private void OnDestroy()
- {
- this.Finish();
- }
- private void Update()
- {
- if (Input.GetKeyUp(KeyCode.F9))
- {
- GameObject gameObject = GameObject.Find("TestMonitor");
- GameObject gameObject2 = GameObject.Find("TestMonitorR");
- if (gameObject != null)
- {
- UnityEngine.Object.Destroy(gameObject);
- UnityEngine.Object @object = Resources.Load("OVR/TestMonitorR");
- GameObject gameObject3 = UnityEngine.Object.Instantiate<GameObject>(@object as GameObject);
- gameObject3.name = @object.name;
- }
- if (gameObject2 != null)
- {
- UnityEngine.Object.Destroy(gameObject2);
- UnityEngine.Object object2 = Resources.Load("OVR/TestMonitor");
- GameObject gameObject4 = UnityEngine.Object.Instantiate<GameObject>(object2 as GameObject);
- gameObject4.name = object2.name;
- }
- }
- if (OvrIK.IsModeVRIK && (this.m_maid == null || !this.m_maid.Visible || !this.m_maid.body0.isLoadedBody))
- {
- this.Finish();
- }
- if (this.m_ik != null)
- {
- if (this.m_maid != null && !this.m_maid.IsBusy)
- {
- for (int i = 0; i < this.m_listDefaultPose.Count; i++)
- {
- KeyValuePair<Transform, Transform> item = this.m_listDefaultPose[i];
- if (item.Key == null)
- {
- Transform transform = CMT.SearchObjName(this.m_maid.body0.m_Bones.transform, item.Value.name, false);
- if (transform != null)
- {
- this.m_listDefaultPose[i] = new KeyValuePair<Transform, Transform>(transform, item.Value);
- }
- else
- {
- this.m_listDefaultPose.Remove(item);
- }
- }
- if (this.m_trMaidDefaultPoseEyeR == null)
- {
- Debug.Log("m_trMaidDefaultPoseEyeR");
- this.m_trMaidDefaultPoseEyeR = this.m_listDefaultPose.Find((KeyValuePair<Transform, Transform> a) => a.Key.name == "Eyepos_R").Value;
- }
- if (item.Key != null)
- {
- item.Value.localPosition = item.Key.localPosition;
- }
- }
- int value = this.m_maid.GetProp(MPN.sintyou).value;
- int value2 = this.m_maid.GetProp(MPN.DouPer).value;
- int value3 = this.m_maid.GetProp(MPN.KubiScl).value;
- if (this.m_nShincho != value || this.m_nDouPer != value2 || this.m_nKubiScl != value3)
- {
- this.m_nShincho = value;
- this.m_nDouPer = value2;
- this.m_nKubiScl = value3;
- }
- if (!this.m_bLegTracking)
- {
- Vector3 position = this.m_trTargetOffsHead.position;
- Vector3 floorPos = GameMain.Instance.OvrMgr.OvrCamera.GetFloorPos(position);
- Transform trTargetOffsFootR = this.m_trTargetOffsFootR;
- Vector3 position2 = new Vector3(position.x, floorPos.y, position.z);
- this.m_trTargetOffsFootL.position = position2;
- trTargetOffsFootR.position = position2;
- }
- }
- this.m_ik.solver.spine.maintainPelvisPosition = ControllerShortcutSettingData.config.maintainPelvisPosition;
- this.m_ik.solver.spine.bodyPosStiffness = ControllerShortcutSettingData.config.bodyPosStiffness;
- this.m_ik.solver.spine.bodyRotStiffness = ControllerShortcutSettingData.config.bodyRotStiffness;
- this.m_ik.solver.spine.chestRotationWeight = ControllerShortcutSettingData.config.chestRotationWeight;
- this.m_ik.solver.spine.pelvisPositionOffset = this.m_vPelvisPosOffs;
- this.m_ik.solver.spine.pelvisRotationOffset = Quaternion.Euler(this.m_vPelvisRotOffs);
- if (this.m_ik.fixTransforms && this.m_ik.GetIKSolver().initiated)
- {
- this.m_ik.GetIKSolver().FixTransforms();
- }
- this.m_ik.UpdateSolverExternal();
- if (this.m_goMoni != null)
- {
- if (this.m_trMoniPlane != null && this.m_rtMoniPlaneTex != null)
- {
- this.m_trMoniPlane.localScale = new Vector3((float)this.m_rtMoniPlaneTex.width / (float)this.m_rtMoniPlaneTex.height, 1f, 1f);
- }
- if (Input.GetKeyDown(KeyCode.Space))
- {
- this.m_goMoni.SetActive(!this.m_goMoni.activeSelf);
- }
- }
- this.CheckHeadIsTracker();
- if (this.m_trEyeTarget != null && this.m_maid != null)
- {
- Transform realHeadTransform = GameMain.Instance.OvrMgr.OvrCamera.GetRealHeadTransform();
- float num = Vector3.Dot(this.m_trEyeTarget.forward, realHeadTransform.forward);
- if (this.m_ik.solver.spine.headTarget == this.m_trTargetOffsHeadTracker)
- {
- num = Vector3.Dot(this.m_trEyeTarget.forward, this.m_trTargetOffsHeadTracker.up);
- }
- if (num < this.m_fEyeToCamThresholdAngle && this.m_bEyeTocam)
- {
- this.m_maid.EyeToCamera(Maid.EyeMoveType.目だけ向ける, 0f);
- }
- else
- {
- this.m_maid.EyeToCamera(Maid.EyeMoveType.無し, 0f);
- }
- }
- for (int j = 0; j < this.m_listTrackerMeshRnder.Count; j++)
- {
- if (this.m_listTrackerMeshRnder[j] != null)
- {
- this.m_listTrackerMeshRnder[j].enabled = false;
- }
- }
- if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyUp(KeyCode.F8))
- {
- if (this.m_trTargetOffsHeadTracker != null)
- {
- if (this.m_ik.solver.spine.headTarget == this.m_trTargetOffsHeadTracker)
- {
- this.m_ik.solver.spine.headTarget = this.m_trTargetOffsHead;
- }
- else
- {
- this.m_ik.solver.spine.headTarget = this.m_trTargetOffsHeadTracker;
- }
- }
- else
- {
- Debug.Log("VRIK トラッカーがありませんので頭ターゲットに。");
- }
- }
- }
- }
- public static List<string> UpdateGeneralModelFileList()
- {
- OvrIK.m_listFileList.Clear();
- string fullPath = Path.GetFullPath(".\\");
- string path = fullPath + "Model";
- if (!Directory.Exists(path))
- {
- return OvrIK.m_listFileList;
- }
- string[] exts = new string[]
- {
- ".obj",
- ".fbx",
- ".dae",
- ".stl",
- ".x",
- ".3ds"
- };
- string[] files = Directory.GetFiles(path, "*.*", SearchOption.AllDirectories);
- IEnumerable<string> source = from file in files
- where exts.Any((string ext) => file.ToLower().EndsWith(ext))
- select file;
- OvrIK.m_listFileList = source.ToList<string>();
- return OvrIK.m_listFileList;
- }
- public static void LoadGeneralModelFile(string f_strRead)
- {
- OvrIK.m_listGeneralModel.RemoveAll((GameObject o) => o == null);
- GameObject gameObject = ImportCM.LoadGeneralModelFile(f_strRead);
- if (gameObject != null)
- {
- MeshRenderer componentInChildren = gameObject.GetComponentInChildren<MeshRenderer>(true);
- if (componentInChildren != null)
- {
- OvrGrabObj ovrGrabObj = gameObject.AddComponent<OvrGrabObj>();
- Rigidbody rigidbody = gameObject.AddComponent<Rigidbody>();
- rigidbody.useGravity = false;
- rigidbody.isKinematic = true;
- ovrGrabObj.m_trTarget = gameObject.transform;
- string text = Path.GetFileName(f_strRead).ToLower();
- if (text.Contains("_useg"))
- {
- rigidbody.useGravity = true;
- rigidbody.isKinematic = false;
- rigidbody.mass = 0.1f;
- gameObject.layer = LayerMask.NameToLayer("OvrTouchLookObj");
- GameMain.Instance.OvrMgr.OvrCamera.SetCameraMask(CameraMain.CameraMask.OvrTouchLookObj, true);
- ovrGrabObj.m_bGrabToKinematic = true;
- ovrGrabObj.m_fEaseRate = 60f;
- ovrGrabObj.m_fGrabThrowRate = 1f;
- }
- if (text.Contains("_sphere"))
- {
- OvrIK.ColliderAutoAdjust(gameObject.AddComponent<SphereCollider>(), OvrIK.GetChildenMeshCombinedBounds(gameObject));
- }
- else if (text.Contains("_capsule"))
- {
- OvrIK.ColliderAutoAdjust(gameObject.AddComponent<CapsuleCollider>(), OvrIK.GetChildenMeshCombinedBounds(gameObject));
- }
- else if (text.Contains("_box"))
- {
- OvrIK.ColliderAutoAdjust(gameObject.AddComponent<BoxCollider>(), OvrIK.GetChildenMeshCombinedBounds(gameObject));
- }
- else if (text.Contains("_mesh"))
- {
- MeshCollider meshCollider = componentInChildren.gameObject.AddComponent<MeshCollider>();
- meshCollider.inflateMesh = true;
- meshCollider.skinWidth = 0.03f;
- meshCollider.convex = true;
- }
- else if (text.Contains("_useg"))
- {
- OvrIK.ColliderAutoAdjust(gameObject.AddComponent<BoxCollider>(), OvrIK.GetChildenMeshCombinedBounds(gameObject));
- }
- else
- {
- MeshCollider meshCollider2 = componentInChildren.gameObject.AddComponent<MeshCollider>();
- meshCollider2.inflateMesh = true;
- meshCollider2.skinWidth = 0.03f;
- meshCollider2.convex = true;
- }
- if (text.Contains("_trans"))
- {
- componentInChildren.sharedMaterial.shader = Shader.Find("CM3D2/Lighted_Trans");
- }
- else
- {
- componentInChildren.sharedMaterial.shader = Shader.Find("CM3D2/Lighted");
- }
- OvrObjAutoDestory ovrObjAutoDestory = gameObject.AddComponent<OvrObjAutoDestory>();
- ovrObjAutoDestory.m_goTarget = gameObject;
- OvrIK.m_listGeneralModel.Add(gameObject);
- }
- Transform realHeadTransform = GameMain.Instance.OvrMgr.OvrCamera.GetRealHeadTransform();
- Vector3 position = new Vector3(realHeadTransform.forward.x, 0f, realHeadTransform.forward.z) * 2f + realHeadTransform.position;
- gameObject.transform.position = position;
- }
- }
- private static Bounds GetChildenMeshCombinedBounds(GameObject obj)
- {
- NDebug.AssertNull(obj);
- Bounds result = default(Bounds);
- MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
- if (componentsInChildren == null || componentsInChildren.Length <= 0)
- {
- return result;
- }
- result = componentsInChildren[0].bounds;
- for (int i = 1; i < componentsInChildren.Length; i++)
- {
- result.Encapsulate(componentsInChildren[i].bounds);
- }
- return result;
- }
- private static void ColliderAutoAdjust(SphereCollider col, Bounds bounds)
- {
- col.center = bounds.center;
- col.radius = bounds.extents.x;
- if (col.radius < bounds.extents.y)
- {
- col.radius = bounds.extents.y;
- }
- if (col.radius < bounds.extents.z)
- {
- col.radius = bounds.extents.z;
- }
- }
- private static void ColliderAutoAdjust(BoxCollider col, Bounds bounds)
- {
- col.center = bounds.center;
- col.size = bounds.size;
- }
- private static void ColliderAutoAdjust(CapsuleCollider col, Bounds bounds)
- {
- col.center = bounds.center;
- int index = 0;
- int num = 2;
- if (bounds.extents[index] > bounds.extents[1])
- {
- index = 1;
- }
- if (bounds.extents[index] > bounds.extents[2])
- {
- index = 2;
- }
- if (bounds.extents[num] < bounds.extents[1])
- {
- num = 1;
- }
- if (bounds.extents[num] < bounds.extents[2])
- {
- num = 2;
- }
- col.radius = bounds.extents[index];
- col.height = bounds.size[num];
- col.direction = num;
- }
- public static void DestroyGeneralModelAll()
- {
- foreach (GameObject gameObject in OvrIK.m_listGeneralModel)
- {
- if (gameObject != null)
- {
- UnityEngine.Object.Destroy(gameObject);
- }
- }
- OvrIK.m_listGeneralModel.Clear();
- }
- private static OvrIK m_this;
- private VRIK m_ik;
- private static OvrIK.OvrIkConfig m_conf = new OvrIK.OvrIkConfig();
- private readonly string[] m_strHandBoneNameL = new string[]
- {
- "Bip01 L Finger02",
- "Bip01 L Finger01",
- "Bip01 L Finger0",
- "Bip01 L Finger12",
- "Bip01 L Finger11",
- "Bip01 L Finger1",
- "Bip01 L Finger22",
- "Bip01 L Finger21",
- "Bip01 L Finger2",
- "Bip01 L Finger32",
- "Bip01 L Finger31",
- "Bip01 L Finger3",
- "Bip01 L Finger42",
- "Bip01 L Finger41",
- "Bip01 L Finger4"
- };
- private readonly string[] m_strHandBoneNameR = new string[]
- {
- "Bip01 R Finger02",
- "Bip01 R Finger01",
- "Bip01 R Finger0",
- "Bip01 R Finger12",
- "Bip01 R Finger11",
- "Bip01 R Finger1",
- "Bip01 R Finger22",
- "Bip01 R Finger21",
- "Bip01 R Finger2",
- "Bip01 R Finger32",
- "Bip01 R Finger31",
- "Bip01 R Finger3",
- "Bip01 R Finger42",
- "Bip01 R Finger41",
- "Bip01 R Finger4"
- };
- private readonly Quaternion[,] m_aryHandRot;
- private Maid m_maid;
- private Transform m_trTargetOffsHead;
- private Transform m_trTargetOffsPelvis;
- private Transform m_trTargetOffsHandL;
- private Transform m_trTargetOffsHandR;
- private Transform m_trTargetOffsFootL;
- private Transform m_trTargetOffsFootR;
- private Transform m_trTargetOffsHeadTracker;
- private Transform m_trTargetOffsFootLVecY;
- private Transform m_trTargetOffsFootRVecY;
- private GameObject m_goDefaultPoseParent;
- private List<KeyValuePair<Transform, Transform>> m_listDefaultPose;
- private Transform m_trMaidDefaultPoseEyeR;
- private Transform m_trMaidDefaultPoseFootR;
- private Transform m_trPlayerDefaultPoseEye;
- private Transform m_trPlayerDefaultPoseFoot;
- private Transform[] m_trHandL;
- private Transform[] m_trHandR;
- public Vector3 m_vPelvisPosOffs;
- public Vector3 m_vPelvisRotOffs;
- private GameObject m_goIKTargetParent;
- private int m_nCensorNum;
- public bool m_bLegTracking;
- private static Coroutine m_coCalibrate = null;
- private GameObject m_self_shot_cam;
- private OvrSelfShotCamera m_coSelfShotCam;
- private GameObject m_goMoni;
- private Transform m_trMoniPlane;
- private RenderTexture m_rtMoniPlaneTex;
- private Transform m_trEyeTarget;
- private PhotoFaceDataShortcutParent m_FaceCompoL;
- private PhotoFaceDataShortcutParent m_FaceCompoR;
- private HandSignShortcut m_coHandSignL;
- private HandSignShortcut m_coHandSignR;
- private OtherCommandShortcut m_coOtherCmdL;
- private OtherCommandShortcut m_coOtherCmdR;
- private static GameObject m_goVRIKConfigUI;
- private static ControllerShortcutWindow m_VRIKConfigCompo;
- private Vector3 m_vBackPos;
- private Vector3 m_vBackRot;
- private Vector3 m_vBackRootPos;
- private Quaternion m_qBackRootRot;
- private List<MeshRenderer> m_listTrackerMeshRnder;
- public float m_fEyeToCamThresholdAngle;
- private bool m_bEyeTocam;
- private bool m_bBackAutoTwistShoulderL;
- private bool m_bBackAutoTwistShoulderR;
- private bool m_bBackAutoTwistWristL;
- private bool m_bBackAutoTwistWristR;
- private bool m_bBackAutoTwistThighL;
- private bool m_bBackAutoTwistThighR;
- private AMTween[] m_aryBackAMTween;
- private bool m_isHeadIsTracker;
- private Vector3 m_vFootDefOffsLocalL;
- private Vector3 m_vFootDefOffsLocalR;
- public float offsy;
- private int m_nShincho;
- private int m_nDouPer;
- private int m_nKubiScl;
- private static List<string> m_listFileList = new List<string>();
- private static List<GameObject> m_listGeneralModel = new List<GameObject>();
- [Serializable]
- public class OvrIkConfig : ISerializationCallbackReceiver
- {
- public void OnBeforeSerialize()
- {
- this.m_nVersion = 1170;
- }
- public void OnAfterDeserialize()
- {
- }
- public bool Write()
- {
- string contents = JsonUtility.ToJson(this, true);
- string path = Path.GetFullPath(".\\") + "OvrIK.json";
- try
- {
- File.WriteAllText(path, contents);
- }
- catch
- {
- Debug.LogError("OvrIK.json の書き込みに失敗。");
- return false;
- }
- return true;
- }
- public OvrIK.OvrIkConfig Read()
- {
- string path = Path.GetFullPath(".\\") + "OvrIK.json";
- if (!File.Exists(path))
- {
- this.Write();
- }
- string json;
- try
- {
- json = File.ReadAllText(path);
- }
- catch
- {
- Debug.LogError("OvrIK.json の読込に失敗。");
- return this;
- }
- return JsonUtility.FromJson<OvrIK.OvrIkConfig>(json);
- }
- public void Update(VRIK f_vrik)
- {
- f_vrik.solver.locomotion.weight = this.solver_locomotion_weight;
- f_vrik.solver.locomotion.footDistance = this.solver_locomotion_footDistance;
- f_vrik.solver.locomotion.stepThreshold = this.solver_locomotion_stepThreshold;
- f_vrik.solver.locomotion.angleThreshold = this.solver_locomotion_angleThreshold;
- f_vrik.solver.locomotion.comAngleMlp = this.solver_locomotion_comAngleMlp;
- f_vrik.solver.locomotion.maxVelocity = this.solver_locomotion_maxVelocity;
- f_vrik.solver.locomotion.velocityFactor = this.solver_locomotion_velocityFactor;
- f_vrik.solver.locomotion.maxLegStretch = this.solver_locomotion_maxLegStretch;
- f_vrik.solver.locomotion.rootSpeed = this.solver_locomotion_rootSpeed;
- f_vrik.solver.locomotion.stepSpeed = this.solver_locomotion_stepSpeed;
- }
- private const string CONF_NAME = "OvrIK.json";
- [SerializeField]
- private int m_nVersion = 1170;
- [SerializeField]
- private float solver_locomotion_weight = 1f;
- [SerializeField]
- private float solver_locomotion_footDistance = 0.1f;
- [SerializeField]
- private float solver_locomotion_stepThreshold = 0.28f;
- [SerializeField]
- private float solver_locomotion_angleThreshold = 60f;
- [SerializeField]
- private float solver_locomotion_comAngleMlp = 1f;
- [SerializeField]
- private float solver_locomotion_maxVelocity = 0.4f;
- [SerializeField]
- private float solver_locomotion_velocityFactor = 0.4f;
- [SerializeField]
- private float solver_locomotion_maxLegStretch = 1f;
- [SerializeField]
- private float solver_locomotion_rootSpeed = 20f;
- [SerializeField]
- private float solver_locomotion_stepSpeed = 3f;
- [SerializeField]
- private bool m_bHeadIsTracker;
- [SerializeField]
- public float m_fEyeToCamThresholdAngle = -0.9f;
- [SerializeField]
- public float leg_no_tracker_pos_weight = 0.3f;
- [SerializeField]
- public float leg_no_tracker_rot_weight = 0.3f;
- }
- }
|