Exemple #1
0
        private void HandleCharacterInput()
        {
            PlayerCharacterInputs characterInputs = new PlayerCharacterInputs();

            // Build the CharacterInputs struct
            characterInputs.MoveAxisForward = Input.GetAxisRaw(VerticalInput);
            characterInputs.MoveAxisRight   = Input.GetAxisRaw(HorizontalInput);
            characterInputs.CameraRotation  = OrbitCamera.Transform.rotation;
            characterInputs.JumpDown        = Input.GetKeyDown(KeyCode.Space);

            // Apply inputs to character
            Character.SetInputs(ref characterInputs);

            // Apply impulse
            if (Input.GetKeyDown(KeyCode.Q))
            {
                Character.Motor.ForceUnground(0.1f);
                Character.AddVelocity(Vector3.one * 10f);
            }
        }