public static void ClosestToPoint(this KinectActor actor, Body[] bodies, UnityEngine.Vector3 point, JointType jointType = JointType.Head) { float distance = float.PositiveInfinity; int index = -1; for (int i = bodies.Length - 1; i >= 0; --i) { if (!bodies[i].IsTracked) { continue; } Vector3 position = bodies[i].JointPositionRealSpace(jointType, KinectActor.CoordinateOrigin, actor.Floor); float sqr = (position - point).sqrMagnitude; if (sqr < distance) { distance = sqr; index = i; } } if (index >= 0) { actor.Refresh(index); } }
public static void FindTallest(this KinectActor actor, Body[] bodies) { float z = 0f; int index = -1; for (int i = bodies.Length - 1; i >= 0; --i) { if (!bodies[i].IsTracked) { continue; } Vector3 position = bodies[i].JointPositionRealSpace(JointType.Head, KinectActor.CoordinateOrigin, actor.Floor); if (position.z > z) { z = position.z; index = i; } } if (index >= 0) { actor.Refresh(index); } }
public void Awake() { this.m_Actor = GetComponent <KinectActor>(); this.m_JointTypeToJoint = new KinectSkeletonJoint[KinectHelper.jointTypeCount]; this.m_Joints = new KinectSkeletonJoint[KinectHelper.jointTypeCount]; this.m_SkipRebuild = false; RebuildJointHierarchy(); }
public static bool InArea(this KinectActor actor, Rect area) { JointType jointType = JointType.SpineMid; if (actor.HeadVisible()) { jointType = JointType.Head; } Vector3 position = actor.GetJointPosition(jointType); return(area.Contains(new Vector2(position.x, position.z))); }
private KinectActor ConstructActor(string name) { KinectActor actor = null; if (this.constructionType == KinectActorConstructionType.Prefab) { actor = Instantiate <KinectActor>(prefab, transform); actor.name = name; } else { actor = new GameObject(name).AddComponent <KinectActor>(); actor.transform.parent = transform; if (this.constructionType == KinectActorConstructionType.Full) { var skeleton = actor.gameObject.AddComponent <KinectSkeleton>(); skeleton.CreateJointTree(JointType.SpineBase); } } return(actor); }
public void Awake() { this.actor = base.GetComponentInChildren <KinectActor>(); Initialize(); }
public void Awake() { this.actor = base.GetComponent <KinectActor>(); }
public virtual void Start() { this.actor = KinectPlayArea.Actor; }
public void Reset() { this.constructionType = KinectActorConstructionType.Full; this.prefab = null; }
public void OnEnable() { this.me = (KinectActor)base.target; this.brain = null; }
public static void DrawGizmos(KinectActor actor, GizmoType type) { Gizmos.color = KinectEditorUtils.green; Gizmos.DrawWireCube(actor.bounds.center, actor.bounds.size); }
public void OnEnable() { this.m_Me = (KinectActor)target; }