private void Pose() {
			// Make sure aiming target is not too close (might make the solver instable when the target is closer to the first bone than the last bone is).
			LimitAimTarget();

			// Get the aiming direction
			Vector3 direction = (aim.solver.target.position - aim.solver.bones[0].transform.position);
			// Getting the direction relative to the root transform
			Vector3 localDirection = transform.InverseTransformDirection(direction);
			
			// Get the Pose from AimPoser
			aimPose = aimPoser.GetPose(localDirection);
			
			// If the Pose has changed
			if (aimPose != lastPose) {
				// Increase the angle buffer of the pose so we won't switch back too soon if the direction changes a bit
				aimPoser.SetPoseActive(aimPose);
				
				// Store the pose so we know if it changes
				lastPose = aimPose;
			}
			
			// Direct blending
			foreach (AimPoser.Pose pose in aimPoser.poses) {
				if (pose == aimPose) {
					DirectCrossFade(pose.name, 1f);
				} else {
					DirectCrossFade(pose.name, 0f);
				}
			}
		}
Пример #2
0
    private void Pose()
    {
        // Get the aiming direction
        Vector3 direction = (aim.solver.target.position - aim.solver.bones[0].transform.position);
        // Getting the direction relative to the root transform
        Vector3 localDirection = transform.InverseTransformDirection(direction);

        // Get the Pose from AimPoser
        aimPose = aimPoser.GetPose(localDirection);

        // If the Pose has changed
        if (aimPose != lastPose)
        {
            // Increase the angle buffer of the pose so we won't switch back too soon if the direction changes a bit
            aimPoser.SetPoseActive(aimPose);

            // Store the pose so we know if it changes
            lastPose = aimPose;
        }

        // Direct blending
        foreach (AimPoser.Pose pose in aimPoser.poses)
        {
            if (pose == aimPose)
            {
                DirectCrossFade(pose.name, 1f);
            }
            else
            {
                DirectCrossFade(pose.name, 0f);
            }
        }
    }
Пример #3
0
        private void Pose()
        {
            // Get the aiming direction
            Vector3 direction = (targetPosition - aim.solver.bones[0].transform.position);
            // Getting the direction relative to the root transform
            Vector3 localDirection = transform.InverseTransformDirection(direction);

            // Get the Pose from AimPoser
            aimPose = aimPoser.GetPose(localDirection);

            // If the Pose has changed
            if (aimPose != lastPose) {
                // CrossFade to the new pose
                animation.CrossFade(aimPose.name);

                // Increase the angle buffer of the pose so we won't switch back too soon if the direction changes a bit
                aimPoser.SetPoseActive(aimPose);

                // Store the pose so we know if it changes
                lastPose = aimPose;
            }
        }