Ejemplo n.º 1
0
        private void ControlBiped(InputManager input, float dTimeMs)
        {
            // If input is in line with avatar orientation, you get all movement, otherwise, some of the movement is dulled to get reorientation

            Vector3 moveInput = Vector3.Zero;

            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.MoveLeftRightRate))
            {
                moveInput.X += input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.MoveLeftRightRate],
                                                                 InputIndex);
            }

            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.MoveDownUpRate))
            {
                moveInput.Z -= input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.MoveDownUpRate],
                                                                 InputIndex);
            }

            float moveAmount = moveInput.Length();

            if (moveAmount > 0.0f)
            {
                // Transform (rotation only) the input from view space into world space
                Matrix cameraRotation = mReferenceCam.Transform;
                cameraRotation.Translation = Vector3.Zero;
                moveInput = Vector3.Transform(moveInput, cameraRotation);

                if (moveInput.X != 0.0f || moveInput.Z != 0.0f)
                {
                    moveInput.Y = 0.0f;
                    Quaternion directionDiff = SpaceUtils.GetSweptQuaternion(BepuConverter.Convert(mBipedControl.Controller.HorizontalViewDirection), moveInput);

                    mBipedControl.OrientationChange = directionDiff;
                }
            }

            mBipedControl.HorizontalMovement = Vector2.UnitY * moveAmount;

            // Crouching:
            if (input.CheckForBinaryInput(ActiveInputMap, BinaryControlActions.Crouch, InputIndex))
            {
                mBipedControl.DesiredMovementActions |= BipedControllerComponent.MovementActions.Crouching;
            }
            else
            {
                mBipedControl.DesiredMovementActions &= ~BipedControllerComponent.MovementActions.Crouching;
            }

            // Jumping:
            if (input.CheckForNewBinaryInput(ActiveInputMap, BinaryControlActions.Jump, InputIndex))
            {
                mBipedControl.DesiredMovementActions |= BipedControllerComponent.MovementActions.Jumping;
            }
            else
            {
                mBipedControl.DesiredMovementActions &= ~BipedControllerComponent.MovementActions.Jumping;
            }
        }
Ejemplo n.º 2
0
        protected override void PrepareInputProcessors(InputManager input)
        {
            PlayerIndex inputIndex = GameResources.PlaySession.LocalPlayers[PlayerId];
            InputMode newMode = mInputMode;

            // TODO: P3: This needs a real state system to manage transitions:

            // Compute next mode:
            if (mInputMode == InputMode.Aiming &&
                !(input.CheckForBinaryInput(mPlayerInputMap, BinaryControlActions.Aim, inputIndex)))
            {
                newMode = InputMode.Aloof;
            }
            else if (mInputMode == InputMode.Aloof &&
                input.CheckForBinaryInput(mPlayerInputMap, BinaryControlActions.Aim, inputIndex))
            {
                newMode = InputMode.Aiming;
            }

            // Take some special actions if there is a mode change:
            if (newMode != mInputMode)
            {
                // Exiting mode tasks:
                switch (mInputMode)
                {
                    case InputMode.Aiming:
                        Actor avatar = GameResources.ActorManager.GetActorById(ActorId);
                        BipedControllerComponent bipedControl = avatar.GetComponent<BipedControllerComponent>(
                            ActorComponent.ComponentType.Control);
                        bipedControl.Controller.ViewDirection = bipedControl.Controller.HorizontalViewDirection;
                        mMmoCameraDesc.Pitch = -MathHelper.Pi / 12.0f;
                        mMmoCameraDesc.Yaw = (float)(Math.Atan2(-bipedControl.Controller.HorizontalViewDirection.X,
                            -bipedControl.Controller.HorizontalViewDirection.Z));

                        DrawSegment.MainWindow.UIElements.Remove(UIElementDepth.CROSSHAIRS);
                        break;
                    default:
                        break;
                }

                // Entering mode tasks:
                switch (newMode)
                {
                    case InputMode.Aiming:
                        DrawSegment.MainWindow.UIElements.Add(UIElementDepth.CROSSHAIRS, mCrosshairs);
                        break;
                    default:
                        break;
                }
            }

            mInputMode = newMode;

            // Handle some misc input functions:

            // Inventory window:
            if (input.CheckForNewBinaryInput(mPlayerInputMap, BinaryControlActions.OpenInventory, inputIndex))
            {
                DrawSegment.AddWindow(mInventoryPanel, inputIndex);
                mInventoryPanel.RefreshItems();
            }

            // TODO: P2: Remove nonessential/debug functionality:

            PlayerIndex dummyPlayerIndex;
            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.V, inputIndex, out dummyPlayerIndex))
            {
                mShadowViewMode = !mShadowViewMode;

                DrawSegment.MainWindow.UIElements.Clear();

                if (mShadowViewMode)
                {
                    DrawSegment.MainWindow.UIElements.Add(UIElementDepth.DEBUG_SHADOW_MAP, new ShadowMapVisual());
                }
                else
                {
                    DrawSegment.MainWindow.UIElements.Add(UIElementDepth.STANDARD_3D_PERSP, new Standard3dPerspective());
                }
            }

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.P, inputIndex, out dummyPlayerIndex))
            {
                Debugger.Break();
            }

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.U, inputIndex, out dummyPlayerIndex))
            {
                mBright += 0.01f;
            }

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.J, inputIndex, out dummyPlayerIndex))
            {
                mBright -= 0.01f;
            }

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.I, inputIndex, out dummyPlayerIndex))
            {
                mContrast += 0.1f;
            }

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.K, inputIndex, out dummyPlayerIndex))
            {
                mContrast -= 0.1f;
            }

            //mBrightParam.SetValue(mBright);
            //mContrastParam.SetValue(mContrast);
        }
Ejemplo n.º 3
0
        private void ControlBiped(InputManager input, float dTimeMs)
        {
            // Aim pitch
            float aimPitch = (float)(Math.Asin(mBipedControl.Controller.ViewDirection.Y));

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.CameraPitchDecrease))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.CameraPitchDecrease])
                {
                    aimPitch += (input.IsBinaryControlDown(control, InputIndex) ? -INPUT_PAD_LOOK_FACTOR * dTimeMs : 0.0f);
                }
            }

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.CameraPitchIncrease))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.CameraPitchIncrease])
                {
                    aimPitch += (input.IsBinaryControlDown(control, InputIndex) ? INPUT_PAD_LOOK_FACTOR * dTimeMs : 0.0f);
                }
            }

            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.CameraPitchRate))
            {
                aimPitch += input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.CameraPitchRate],
                                                              InputIndex) * INPUT_PAD_LOOK_FACTOR * dTimeMs;
            }

            if (ActiveInputMap.FullAxisMap.ContainsKey(FullAxisControlActions.CameraPitchDelta))
            {
                aimPitch += input.GetFullAxisControlValue(ActiveInputMap.FullAxisMap[FullAxisControlActions.CameraPitchDelta],
                                                          InputIndex) * INPUT_MOUSE_LOOK_FACTOR;
            }

            aimPitch = MathHelper.Clamp(aimPitch, -2.0f * MathHelper.Pi / 5.0f, 2.0f * MathHelper.Pi / 5.0f);

            // Aim yaw
            Quaternion yawOrientationChange = Quaternion.Identity;

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.TurnLeft))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.TurnLeft])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                    {
                        yawOrientationChange *= Quaternion.CreateFromAxisAngle(Vector3.Up, INPUT_PAD_LOOK_FACTOR * dTimeMs);
                    }
                }
            }

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.TurnRight))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.TurnRight])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                    {
                        yawOrientationChange *= Quaternion.CreateFromAxisAngle(Vector3.Up, -INPUT_PAD_LOOK_FACTOR * dTimeMs);
                    }
                }
            }

            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.TurnLeftRightRate))
            {
                yawOrientationChange *= Quaternion.CreateFromAxisAngle(Vector3.Up,
                                                                       -input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.TurnLeftRightRate],
                                                                                                          InputIndex) * INPUT_PAD_LOOK_FACTOR * dTimeMs);
            }

            if (ActiveInputMap.FullAxisMap.ContainsKey(FullAxisControlActions.TurnLeftRightDelta))
            {
                float fullAxisYawAmount = input.GetFullAxisControlValue(ActiveInputMap.FullAxisMap[FullAxisControlActions.TurnLeftRightDelta],
                                                                        InputIndex);
                yawOrientationChange *= Quaternion.CreateFromAxisAngle(Vector3.Up, -fullAxisYawAmount * INPUT_MOUSE_LOOK_FACTOR);
            }

            // It's good practice to make sure floating point errors don't accumulate and change the length of our unit quaternion:
            yawOrientationChange            = Quaternion.Normalize(yawOrientationChange);
            mBipedControl.OrientationChange = yawOrientationChange;

            mBipedControl.Controller.ViewDirection = mBipedControl.Controller.HorizontalViewDirection + BEPUutilities.Vector3.Up * (float)(Math.Sin(aimPitch));

            // Character movement:
            Vector2 rawMovement = Vector2.Zero;

            // Character movement (binary):
            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.MoveForward))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.MoveForward])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                    {
                        rawMovement += new Vector2(0.0f, 1.0f);
                        break;
                    }
                }
            }

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.MoveBackward))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.MoveBackward])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                    {
                        rawMovement += new Vector2(0.0f, -1.0f);
                        break;
                    }
                }
            }

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.StrafeLeft))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.StrafeLeft])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                    {
                        rawMovement += new Vector2(-1.0f, 0.0f);
                        break;
                    }
                }
            }

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.StrafeRight))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.StrafeRight])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                    {
                        rawMovement += new Vector2(1.0f, 0.0f);
                        break;
                    }
                }
            }

            // Character movement (interval i.e. pad):
            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.StrafeLeftRightRate))
            {
                rawMovement.X += input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.StrafeLeftRightRate],
                                                                   InputIndex);
            }

            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.MoveForwardBackwardRate))
            {
                rawMovement.Y += input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.MoveForwardBackwardRate],
                                                                   InputIndex);
            }

            // Character movement (full axis i.e. mouse):
            if (ActiveInputMap.FullAxisMap.ContainsKey(FullAxisControlActions.StrafeLeftRightDelta))
            {
                rawMovement.X += input.GetFullAxisControlValue(ActiveInputMap.FullAxisMap[FullAxisControlActions.StrafeLeftRightDelta],
                                                               InputIndex) * INPUT_MOUSE_MOVE_FACTOR;
            }

            if (ActiveInputMap.FullAxisMap.ContainsKey(FullAxisControlActions.MoveForwardBackwardDelta))
            {
                rawMovement.Y += input.GetFullAxisControlValue(ActiveInputMap.FullAxisMap[FullAxisControlActions.MoveForwardBackwardDelta],
                                                               InputIndex) * INPUT_MOUSE_MOVE_FACTOR;
            }

            mBipedControl.HorizontalMovement = rawMovement;

            // Jumping:
            if (input.CheckForNewBinaryInput(ActiveInputMap, BinaryControlActions.Jump, InputIndex))
            {
                mBipedControl.DesiredMovementActions |= BipedControllerComponent.MovementActions.Jumping;
            }
            else
            {
                mBipedControl.DesiredMovementActions &= ~BipedControllerComponent.MovementActions.Jumping;
            }
        }
Ejemplo n.º 4
0
        protected override void PrepareInputProcessors(InputManager input)
        {
            PlayerIndex inputIndex = GameResources.PlaySession.LocalPlayers[PlayerId];
            InputMode   newMode    = mInputMode;

            // TODO: P3: This needs a real state system to manage transitions:

            // Compute next mode:
            if (mInputMode == InputMode.Aiming &&
                !(input.CheckForBinaryInput(mPlayerInputMap, BinaryControlActions.Aim, inputIndex)))
            {
                newMode = InputMode.Aloof;
            }
            else if (mInputMode == InputMode.Aloof &&
                     input.CheckForBinaryInput(mPlayerInputMap, BinaryControlActions.Aim, inputIndex))
            {
                newMode = InputMode.Aiming;
            }

            // Take some special actions if there is a mode change:
            if (newMode != mInputMode)
            {
                // Exiting mode tasks:
                switch (mInputMode)
                {
                case InputMode.Aiming:
                    Actor avatar = GameResources.ActorManager.GetActorById(ActorId);
                    BipedControllerComponent bipedControl = avatar.GetComponent <BipedControllerComponent>(
                        ActorComponent.ComponentType.Control);
                    bipedControl.Controller.ViewDirection = bipedControl.Controller.HorizontalViewDirection;
                    mMmoCameraDesc.Pitch = -MathHelper.Pi / 12.0f;
                    mMmoCameraDesc.Yaw   = (float)(Math.Atan2(-bipedControl.Controller.HorizontalViewDirection.X,
                                                              -bipedControl.Controller.HorizontalViewDirection.Z));

                    DrawSegment.MainWindow.UIElements.Remove(UIElementDepth.CROSSHAIRS);
                    break;

                default:
                    break;
                }

                // Entering mode tasks:
                switch (newMode)
                {
                case InputMode.Aiming:
                    DrawSegment.MainWindow.UIElements.Add(UIElementDepth.CROSSHAIRS, mCrosshairs);
                    break;

                default:
                    break;
                }
            }

            mInputMode = newMode;

            // Handle some misc input functions:

            // Inventory window:
            if (input.CheckForNewBinaryInput(mPlayerInputMap, BinaryControlActions.OpenInventory, inputIndex))
            {
                DrawSegment.AddWindow(mInventoryPanel, inputIndex);
                mInventoryPanel.RefreshItems();
            }

            // TODO: P2: Remove nonessential/debug functionality:

            PlayerIndex dummyPlayerIndex;

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.V, inputIndex, out dummyPlayerIndex))
            {
                mShadowViewMode = !mShadowViewMode;

                DrawSegment.MainWindow.UIElements.Clear();

                if (mShadowViewMode)
                {
                    DrawSegment.MainWindow.UIElements.Add(UIElementDepth.DEBUG_SHADOW_MAP, new ShadowMapVisual());
                }
                else
                {
                    DrawSegment.MainWindow.UIElements.Add(UIElementDepth.STANDARD_3D_PERSP, new Standard3dPerspective());
                }
            }

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.P, inputIndex, out dummyPlayerIndex))
            {
                Debugger.Break();
            }

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.U, inputIndex, out dummyPlayerIndex))
            {
                mBright += 0.01f;
            }

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.J, inputIndex, out dummyPlayerIndex))
            {
                mBright -= 0.01f;
            }

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.I, inputIndex, out dummyPlayerIndex))
            {
                mContrast += 0.1f;
            }

            if (input.IsNewKeyPress(Microsoft.Xna.Framework.Input.Keys.K, inputIndex, out dummyPlayerIndex))
            {
                mContrast -= 0.1f;
            }

            //mBrightParam.SetValue(mBright);
            //mContrastParam.SetValue(mContrast);
        }
        private void ControlBiped(InputManager input, float dTimeMs)
        {
            // Aim pitch
            float aimPitch = (float)(Math.Asin(mBipedControl.Controller.ViewDirection.Y));
            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.CameraPitchDecrease))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.CameraPitchDecrease])
                {
                    aimPitch += (input.IsBinaryControlDown(control, InputIndex) ? -INPUT_PAD_LOOK_FACTOR * dTimeMs : 0.0f);
                }
            }

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.CameraPitchIncrease))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.CameraPitchIncrease])
                {
                    aimPitch += (input.IsBinaryControlDown(control, InputIndex) ? INPUT_PAD_LOOK_FACTOR * dTimeMs : 0.0f);
                }
            }

            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.CameraPitchRate))
            {
                aimPitch += input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.CameraPitchRate],
                    InputIndex) * INPUT_PAD_LOOK_FACTOR * dTimeMs;
            }

            if (ActiveInputMap.FullAxisMap.ContainsKey(FullAxisControlActions.CameraPitchDelta))
            {
                aimPitch += input.GetFullAxisControlValue(ActiveInputMap.FullAxisMap[FullAxisControlActions.CameraPitchDelta],
                    InputIndex) * INPUT_MOUSE_LOOK_FACTOR;
            }

            aimPitch = MathHelper.Clamp(aimPitch, -2.0f * MathHelper.Pi / 5.0f, 2.0f * MathHelper.Pi / 5.0f);

            // Aim yaw
            Quaternion yawOrientationChange = Quaternion.Identity;
            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.TurnLeft))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.TurnLeft])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                        yawOrientationChange *= Quaternion.CreateFromAxisAngle(Vector3.Up, INPUT_PAD_LOOK_FACTOR * dTimeMs);
                }
            }

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.TurnRight))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.TurnRight])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                        yawOrientationChange *= Quaternion.CreateFromAxisAngle(Vector3.Up, -INPUT_PAD_LOOK_FACTOR * dTimeMs);
                }
            }

            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.TurnLeftRightRate))
            {
                yawOrientationChange *= Quaternion.CreateFromAxisAngle(Vector3.Up,
                    -input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.TurnLeftRightRate],
                    InputIndex) * INPUT_PAD_LOOK_FACTOR * dTimeMs);
            }

            if (ActiveInputMap.FullAxisMap.ContainsKey(FullAxisControlActions.TurnLeftRightDelta))
            {
                float fullAxisYawAmount = input.GetFullAxisControlValue(ActiveInputMap.FullAxisMap[FullAxisControlActions.TurnLeftRightDelta],
                    InputIndex);
                yawOrientationChange *= Quaternion.CreateFromAxisAngle(Vector3.Up, -fullAxisYawAmount * INPUT_MOUSE_LOOK_FACTOR);
            }

            // It's good practice to make sure floating point errors don't accumulate and change the length of our unit quaternion:
            yawOrientationChange = Quaternion.Normalize(yawOrientationChange);
            mBipedControl.OrientationChange = yawOrientationChange;

            mBipedControl.Controller.ViewDirection = mBipedControl.Controller.HorizontalViewDirection + BEPUutilities.Vector3.Up * (float)(Math.Sin(aimPitch));

            // Character movement:
            Vector2 rawMovement = Vector2.Zero;

            // Character movement (binary):
            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.MoveForward))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.MoveForward])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                    {
                        rawMovement += new Vector2(0.0f, 1.0f);
                        break;
                    }
                }
            }

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.MoveBackward))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.MoveBackward])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                    {
                        rawMovement += new Vector2(0.0f, -1.0f);
                        break;
                    }
                }
            }

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.StrafeLeft))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.StrafeLeft])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                    {
                        rawMovement += new Vector2(-1.0f, 0.0f);
                        break;
                    }
                }
            }

            if (ActiveInputMap.BinaryMap.ContainsKey(BinaryControlActions.StrafeRight))
            {
                foreach (BinaryControls control in ActiveInputMap.BinaryMap[BinaryControlActions.StrafeRight])
                {
                    if (input.IsBinaryControlDown(control, InputIndex))
                    {
                        rawMovement += new Vector2(1.0f, 0.0f);
                        break;
                    }
                }
            }

            // Character movement (interval i.e. pad):
            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.StrafeLeftRightRate))
            {
                rawMovement.X += input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.StrafeLeftRightRate],
                    InputIndex);
            }

            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.MoveForwardBackwardRate))
            {
                rawMovement.Y += input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.MoveForwardBackwardRate],
                    InputIndex);
            }

            // Character movement (full axis i.e. mouse):
            if (ActiveInputMap.FullAxisMap.ContainsKey(FullAxisControlActions.StrafeLeftRightDelta))
            {
                rawMovement.X += input.GetFullAxisControlValue(ActiveInputMap.FullAxisMap[FullAxisControlActions.StrafeLeftRightDelta],
                    InputIndex) * INPUT_MOUSE_MOVE_FACTOR;
            }

            if (ActiveInputMap.FullAxisMap.ContainsKey(FullAxisControlActions.MoveForwardBackwardDelta))
            {
                rawMovement.Y += input.GetFullAxisControlValue(ActiveInputMap.FullAxisMap[FullAxisControlActions.MoveForwardBackwardDelta],
                    InputIndex) * INPUT_MOUSE_MOVE_FACTOR;
            }

            mBipedControl.HorizontalMovement = rawMovement;

            // Jumping:
            if (input.CheckForNewBinaryInput(ActiveInputMap, BinaryControlActions.Jump, InputIndex))
            {
                mBipedControl.DesiredMovementActions |= BipedControllerComponent.MovementActions.Jumping;
            }
            else
            {
                mBipedControl.DesiredMovementActions &= ~BipedControllerComponent.MovementActions.Jumping;
            }
        }
        private void ControlBiped(InputManager input, float dTimeMs)
        {
            // If input is in line with avatar orientation, you get all movement, otherwise, some of the movement is dulled to get reorientation

            Vector3 moveInput = Vector3.Zero;

            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.MoveLeftRightRate))
            {
                moveInput.X += input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.MoveLeftRightRate],
                    InputIndex);
            }

            if (ActiveInputMap.FullIntervalMap.ContainsKey(FullIntervalControlActions.MoveDownUpRate))
            {
                moveInput.Z -= input.GetFullIntervalControlValue(ActiveInputMap.FullIntervalMap[FullIntervalControlActions.MoveDownUpRate],
                    InputIndex);
            }

            float moveAmount = moveInput.Length();

            if (moveAmount > 0.0f)
            {
                // Transform (rotation only) the input from view space into world space
                Matrix cameraRotation = mReferenceCam.Transform;
                cameraRotation.Translation = Vector3.Zero;
                moveInput = Vector3.Transform(moveInput, cameraRotation);

                if (moveInput.X != 0.0f || moveInput.Z != 0.0f)
                {
                    moveInput.Y = 0.0f;
                    Quaternion directionDiff = SpaceUtils.GetSweptQuaternion(BepuConverter.Convert(mBipedControl.Controller.HorizontalViewDirection), moveInput);

                    mBipedControl.OrientationChange = directionDiff;
                }
            }

            mBipedControl.HorizontalMovement = Vector2.UnitY * moveAmount;

            // Crouching:
            if (input.CheckForBinaryInput(ActiveInputMap, BinaryControlActions.Crouch, InputIndex))
            {
                mBipedControl.DesiredMovementActions |= BipedControllerComponent.MovementActions.Crouching;
            }
            else
            {
                mBipedControl.DesiredMovementActions &= ~BipedControllerComponent.MovementActions.Crouching;
            }

            // Jumping:
            if (input.CheckForNewBinaryInput(ActiveInputMap, BinaryControlActions.Jump, InputIndex))
            {
                mBipedControl.DesiredMovementActions |= BipedControllerComponent.MovementActions.Jumping;
            }
            else
            {
                mBipedControl.DesiredMovementActions &= ~BipedControllerComponent.MovementActions.Jumping;
            }
        }