Man I ripped out so much code today. For like 3 hours ripping out code.
But I just got it so you can build and modify the user input from the gamemode.
/// <summary>
/// Clientside only. Called every frame to process the input.
/// The results of this input are encoded into a user command and
/// passed to the PlayerController both clientside and serverside.
/// This routine is mainly responsible for taking input from mouse/controller
/// and building look angles and move direction.
/// </summary>
public override void OnInput( ClientInput input )
{
if ( input.Paused )
{
input.Clear();
return;
}
//
// If we're using the mouse then increase pitch sensitivity
//
if ( input.UsingMouse )
{
input.AnalogLook.pitch *= 1.5f;
}
// add the view move, clamp pitch
input.ViewAngles += input.AnalogLook;
input.ViewAngles.pitch = input.ViewAngles.pitch.Clamp( -89, 89 );
// Just copy input as is
input.InputDirection = input.AnalogMove;
}
This should let us change the sensitivity or clamp the view etc, allowing for different types of gamemodes etc.
I’m gonna feed this input to the camera, the player and the player controller. That’ll give them all a chance to modify it before returning it back to the game.