Exemple #1
0
 protected virtual void UpdateHairVisibility()
 {
     if (_hairRenderer)
     {
         _hairRenderer.gameObject.layer = LayerMask.NameToLayer(_animator == _vrManager.GetAnimatorTarget() ? "Hair" : "Default");
     }
 }
Exemple #2
0
        protected virtual void UpdateCharacterController()
        {
            if (_characterController)
            {
                Animator animator = _vrManager.GetAnimatorTarget();

                //Compute the height of the collider
                float h = animator.GetEyeCenterPosition().y - animator.transform.position.y;
                _characterController.height = h;
                _characterController.center = new Vector3(0, h * 0.5f + _characterController.skinWidth, 0);

                //Compute the radius
                Vector3 v = animator.GetBoneTransform(HumanBodyBones.LeftUpperArm).position - animator.GetBoneTransform(HumanBodyBones.RightUpperArm).position;
                v = Vector3.ProjectOnPlane(v, animator.transform.up);
                _characterController.radius = v.magnitude / 2;
            }
        }