Example #1
0
        public void GetBones()
        {
            var animator = GetComponent <Animator>();

            if (animator != null)
            {
                LeftEye  = OffsetOnTransform.Create(animator.GetBoneTransform(HumanBodyBones.LeftEye));
                RightEye = OffsetOnTransform.Create(animator.GetBoneTransform(HumanBodyBones.RightEye));
                Head     = OffsetOnTransform.Create(animator.GetBoneTransform(HumanBodyBones.Head));
            }
        }
Example #2
0
        public void CopyTo(GameObject _dst, Dictionary <Transform, Transform> map)
        {
            var dst = _dst.AddComponent <VRMLookAt>();

            dst.Target   = Target;
            dst.Head     = OffsetOnTransform.Create(map[Head.Transform]);
            dst.RightEye = OffsetOnTransform.Create(map[RightEye.Transform]);
            dst.LeftEye  = OffsetOnTransform.Create(map[LeftEye.Transform]);

            dst.HorizontalOuter = HorizontalOuter;
            dst.HorizontalInner = HorizontalInner;
            dst.VerticalDown    = VerticalDown;
            dst.VerticalUp      = VerticalUp;
        }
Example #3
0
        void Update()
        {
            if (Target != m_offsetTransform.Transform)
            {
                m_offsetTransform = OffsetOnTransform.Create(Target);
            }

            var target = m_offsetTransform.Transform;

            if (target != null)
            {
                var targetPosition = target.position + m_offset;
                transform.position = targetPosition + (m_offsetTransform.WorldMatrix.ExtractRotation() * Vector3.forward) * m_distance;
                transform.LookAt(targetPosition);
            }
        }