public void ComputeIKTarget(Collision oppClsPart, Collider oppCldPart, Transform myPart) { //Animator ani = this.GetComponent<Animator> (); //AnimatorStateInfo info = ani.GetCurrentAniatorStateInfo(0); Vector3 back = _multi.hashMap.back; // if(myPart.name.GetHashCode() == _multi.hashMap.GetHash(eHashIdx.Bone_Weapon_Sword_Left)) // { // _ik_armLeft.ToggleOn (); // _ik_armLeft._targetPos.position = _ik_armLeft._targetEndPos.position; // } if (myPart.name.GetHashCode() == _multi.hashMap.GetHash(eHashIdx.Bone_Weapon_Sword_Right)) { _firstTrigger = true; if (true == _availableAttack && true == _firstTrigger) { _firstTrigger = false; _ik_armRight.ToggleOn(); _ik_armRight._targetPos.position = _ik_armRight._joint2EndPos.position; //_ik_armRight._targetPos.position = oppCldPart.ClosestPointOnBounds (oppClsPart.contacts[0].point + back*3); //_ik_armRight._targetPos.position = oppClsPart.contacts[0].normal + oppClsPart.contacts[0].point; } } }
public override void OnInspectorGUI() { DrawDefaultInspector(); IK2Chain myScript = (IK2Chain)target; EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button(myScript.invert ? "Inverted" : "Not Inveted")) { myScript.invert = !myScript.invert; } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(myScript.toggleIK ? "IK ON" : "IK OFF")) { //true -> false if (true == myScript.toggleIK) { myScript.ToggleOff(true); } //false -> true else { myScript.ToggleOn(); } } // if (GUILayout.Button("Update Bones")) // myScript.UpdateBones(); EditorGUILayout.EndHorizontal(); }