Ejemplo n.º 1
0
        public KinematicInfo(float[] angles, int depth)
        {
            Angles = angles;
            int numberOfJoints = Mathf.Min(angles.Length, depth);

            jointsInfo = new JointInformation[numberOfJoints];
            for (int i = 0; i < numberOfJoints; i++)
            {
                jointsInfo[i] = new JointInformation();
                //Debug.Log("Joint at :" + i + " is no longer null\n");
            }
        }
Ejemplo n.º 2
0
    public void SetTrackingData(Animator _Animator, HumanBodyBonesTrackData _BoneData, Animator _Compare, BodyController _Controller)
    {
        CurrentAnimator       = _Animator;
        CurrentBoneData       = _BoneData;
        AnimatorToCompareTo   = _Compare;
        CurrentBodyController = _Controller;

        //J.transform.SetParent(transform);
        if (CurrentBoneData.ShowJointInfo)
        {
            GameObject J = Instantiate(CurrentBodyController.JointInfoPrefab, transform.position, Quaternion.identity);
            JI = J.GetComponent <JointInformation> ();
            JI.UpdateInformation(CurrentBoneData.NameOverWrite != "" ? CurrentBoneData.NameOverWrite : CurrentBoneData.Joint.ToString());
            transform.position    = CurrentAnimator.GetBoneTransform(CurrentBoneData.Joint).position;
            JI.transform.position = transform.position;
            JointInfoStartingPos  = JI.transform.position;
            JI.transform.position = JointInfoStartingPos + CurrentBoneData.JointInfoOffsetPos;
        }
    }
Ejemplo n.º 3
0
    private void DrawKinematicInfoGizmos()
    {
        Vector3 VerticalOffset = Vector3.up * 1.25f;

        KinematicInfo info = CurrentResults;

        if (enabled && ShouldDrawKinematicGizmos)
        {
            for (int i = 0; i < info.JointCount; i++)
            {
                JointInformation joint = info.GetJointInformation(i);
                Gizmos.color = new Color(1, 1, 1, .5f);
                Gizmos.DrawCube(VerticalOffset + joint.Position + Vector3.up * i * .05f, Vector3.one * .05f);
                Gizmos.color = Color.green;
                Gizmos.DrawRay(VerticalOffset + joint.Position + Vector3.up * i * .05f, joint.UpDirection.normalized);
                Gizmos.color = Color.blue;
                Gizmos.DrawRay(VerticalOffset + joint.Position + Vector3.up * i * .05f, joint.RightDirection.normalized);
            }
        }
    }