Exemplo n.º 1
0
        void LateUpdate()
        {
            // Making sure this works with Animate Physics
            if (!animatePhysics)
            {
                updateFrame = true;
            }
            if (!updateFrame)
            {
                return;
            }
            updateFrame = false;

            // Put the camera back to its default local position relative to the head
            cam.transform.localPosition = camDefaultLocalPosition;

            // Remember the camera's position relative to the gun target
            camRelativeToGunTarget = gunTarget.InverseTransformPoint(cam.transform.position);

            // Update the camera
            cam.LateUpdate();

            // Rotating the root of the character if it is past maxAngle from the camera forward
            RotateCharacter();

            Aiming();

            LookDownTheSight();
        }
Exemplo n.º 2
0
        void LateUpdate()
        {
            // Making sure this works with Animate Physics
            if (!animatePhysics)
            {
                updateFrame = true;
            }
            if (!updateFrame)
            {
                return;
            }
            updateFrame = false;

            // Put the camera back to it's default local position relative to the head
            cam.transform.localPosition = camDefaultLocalPosition;

            // Remember the camera's position relative to the gun target
            camRelativeToGunTarget = gunTarget.InverseTransformPoint(cam.transform.position);

            // Update the camera
            cam.LateUpdate();

            // Rotating the root of the character if it is past maxAngle from the camera forward
            RotateCharacter();

            // Set FBBIK positionWeight for the hands
            ik.solver.leftHandEffector.positionWeight  = aimWeight > 0 && sightWeight > 0? aimWeight * sightWeight: 0f;
            ik.solver.rightHandEffector.positionWeight = ik.solver.leftHandEffector.positionWeight;

            Aiming();
            LookDownTheSight();
        }