/* * Dictionary<ZigJointId, GameObject> mDebugCharacter = new Dictionary<ZigJointId, GameObject>(); * public static ZigJointId[] mFullJoints = { ZigJointId.Neck, ZigJointId.LeftElbow, ZigJointId.LeftKnee, ZigJointId.LeftShoulder, ZigJointId.LeftHip, ZigJointId.RightElbow, ZigJointId.RightKnee, ZigJointId.RightShoulder, ZigJointId.RightHip, ZigJointId.Torso}; * public static ZigJointId[] mStubJoints = { ZigJointId.LeftHand, ZigJointId.RightHand, ZigJointId.LeftAnkle, ZigJointId.RightAnkle }; * public void create_debug_character() * { * GameObject parent = new GameObject("DEBUG_CHARACTER_PARENT"); * foreach (ZigJointId e in mFullJoints) * { * GameObject j = (GameObject)GameObject.Instantiate(mManager.mReferences.mDebugLimb); * j.transform.parent = parent.transform; * j.transform.localScale = new Vector3(30, 30, 30); * mDebugCharacter[e] = j; * } * foreach (ZigJointId e in mStubJoints) * { * GameObject j = (GameObject)GameObject.Instantiate(mManager.mReferences.mDebugLimb); * GameObject.Destroy(j.transform.FindChild("Cylinder")); * j.transform.parent = parent.transform; * j.transform.localScale = new Vector3(30, 30, 30); * mDebugCharacter[e] = j; * } * } * public void update_debug_character() * { * foreach (var e in mDebugCharacter) * { * e.Value.transform.position = mManager.mZigManager.Joints[e.Key].Position; * e.Value.transform.rotation = mManager.mZigManager.Joints[e.Key].Rotation; * } * }*/ public override void Update() { if (mManager.mZigManager.has_user()) { //Pose targetPose = mManager.mGameManager.CurrentTargetPose; //Pose currentPose = mManager.mGameManager.CurrentPose; //this may have one frame of lag but oh well foreach (KeyValuePair <ZgJointId, Stupid> e in mImportant) { if (e.Key != ZgJointId.None && e.Key != ZgJointId.Waist) { //ZgJointId parentJoint = BodyManager.get_parent(e.Key); try { /* note, if you do snapping, you need to turn it off for baby * if (parentJoint == ZigJointId.None || (parentJoint == ZigJointId.Waist) || mImportant[parentJoint].smoothing.snapped == true) * { * if(e.Value.smoothing.snap_change(get_relative(mManager.mZigManager.Joints[e.Key], mManager.mZigManager.Joints[e.Value.otherEnd]), mManager.mTransparentBodyManager.mFlat.mTargetPose.find_element(e.Key).angle, mSmoothing)) * ;// Debug.Log("SNAP " + e.Key); * } * else*/ { e.Value.smoothing.change(get_relative(mManager.mZigManager.Joints[e.Key], mManager.mZigManager.Joints[e.Value.otherEnd]), mSmoothing); } } catch { //TODO wyh does this fail on first run? } } } try { float waistAngle = get_waist(mManager.mZigManager.Joints[ZgJointId.Torso], mManager.mZigManager.Joints[ZgJointId.LeftKnee], mManager.mZigManager.Joints[ZgJointId.RightKnee]); //waist smoothing angle hack /* * if(!mManager.mZigManager.using_nite() && targetPose != null) * { * float interp = Mathf.Clamp01( * (ProGrading.grade_joint(currentPose,targetPose,ZigJointId.LeftHip) + * ProGrading.grade_joint(currentPose,targetPose,ZigJointId.RightHip))/100f); * waistAngle = targetPose.find_element(ZigJointId.Waist).angle * (1-interp) + waistAngle * interp; * }*/ mWaist.change(waistAngle, mSmoothing); //mWaist.snap_change(get_waist(mManager.mZigManager.Joints[ZigJointId.Waist], mManager.mZigManager.Joints[ZigJointId.LeftKnee], mManager.mZigManager.Joints[ZigJointId.RightKnee]), mManager.mTransparentBodyManager.mTargetPose.find_element(ZigJointId.Waist).angle, mSmoothing); //mWaist.change(get_waist(mManager.mZigManager.Joints[ZigJointId.Waist], mManager.mZigManager.Joints[ZigJointId.LeftKnee], mManager.mZigManager.Joints[ZigJointId.RightKnee]), mSmoothing); //mWaist.target = get_waist(mManager.mZigManager.Joints[ZigJointId.Waist], mManager.mZigManager.Joints[ZigJointId.LeftHip], mManager.mZigManager.Joints[ZigJointId.RightHip]); } catch { } } }