public void Update() { KinectActor trackedActor = m_Locomotion.Actor; if (trackedActor == null) { return; } Vector2 lean = trackedActor.lean; float sqrMag = lean.sqrMagnitude; if (lean.sqrMagnitude < m_deadZone * m_deadZone) { return; } Vector3 moveDir = new Vector3(lean.x, 0, lean.y); Rigidbody rb = m_Locomotion.rigidbdy; if (rb != null) { rb.velocity = moveDir * Mathf.Lerp(0.0f, m_Locomotion.maxWalkingSpeed, sqrMag); return; } m_Locomotion.target.position += moveDir * Mathf.Lerp(0.0f, m_Locomotion.maxWalkingSpeed, sqrMag) * Time.deltaTime; }
protected void TryUpdateNewActor() { KinectActor actor = m_State.locomotion.Actor; if (actor == null) { return; } if (m_State.currentActor != null && m_State.currentActor.trackingId == actor.trackingId) { return; } m_State.currentActor = actor; }
public void Awake() { this.manager = base.GetComponentInParent <MenuManager>(); this.actor = this.manager.KinectBrain.GetComponentInChildren <KinectActor>(); this.types = new JointType[] { JointType.Head, JointType.HandLeft, JointType.HandRight, JointType.ElbowLeft, JointType.ElbowRight, JointType.ShoulderLeft, JointType.ShoulderRight, JointType.SpineShoulder, JointType.SpineMid, JointType.KneeLeft, JointType.KneeRight, JointType.AnkleLeft, JointType.AnkleRight, JointType.FootLeft, JointType.FootRight }; this.area = this.manager.KinectBrain.Settings.TrackingAreaCentered(); }