예제 #1
0
        // First-person functions

        private void FirstPersonControlPlayer()
        {
            Vector2 freeAim = KickStarter.playerInput.GetFreeAim();

            if (freeAim.magnitude > KickStarter.settingsManager.dragWalkThreshold / 10f)
            {
                freeAim.Normalize();
                freeAim *= KickStarter.settingsManager.dragWalkThreshold / 10f;
            }

            //float rotationX = KickStarter.player.transform.localEulerAngles.y + freeAim.x * firstPersonCamera.sensitivity.x;
            //float rotationX = KickStarter.player.TransformRotation.eulerAngles.y + (freeAim.x * firstPersonCamera.sensitivity.x);
            float rotationX = KickStarter.player.TransformRotation.eulerAngles.y;

            if (firstPersonCamera != null)
            {
                rotationX += (freeAim.x * firstPersonCamera.sensitivity.x);
                firstPersonCamera.IncreasePitch(-freeAim.y);
            }
            else
            {
                rotationX += (freeAim.x * 15f);
            }

            Quaternion rot = Quaternion.AngleAxis(rotationX, Vector3.up);

            KickStarter.player.SetRotation(rot);
            KickStarter.player.ForceTurnFloat(freeAim.x * 2f);
        }
예제 #2
0
        // First-person functions

        private void FirstPersonControlPlayer()
        {
            if (firstPersonCamera)
            {
                Vector2 freeAim = KickStarter.playerInput.GetFreeAim();
                if (freeAim.magnitude > KickStarter.settingsManager.dragWalkThreshold / 10f)
                {
                    freeAim.Normalize();
                    freeAim *= KickStarter.settingsManager.dragWalkThreshold / 10f;
                }
                float rotationX = KickStarter.player.transform.localEulerAngles.y + freeAim.x * firstPersonCamera.sensitivity.x;
                //firstPersonCamera.rotationY -= freeAim.y * firstPersonCamera.sensitivity.y;
                firstPersonCamera.IncreasePitch(-freeAim.y);
                Quaternion rot = Quaternion.AngleAxis(rotationX, Vector3.up);
                KickStarter.player.SetRotation(rot);
            }
        }