User Tools

Site Tools


Sidebar

changing_the_input_controller

The Input Controller system for Atavism can be easily changed by creating a new C# script that inherits from the AtavismInputController class. Here is an example of the core basics that is needed:

  public class ExampleInputController : AtavismInputController  {
  
// Use this for initialization
void Start () {
	// Need to tell the client that this is the new active input controller
	ClientAPI.InputControllerActivated(this);
}

public override Vector3 GetPlayerMovement() {
	Vector3 playerMovementVector = Vector3.zero;
	// Do your input handling here, and update the playerMovementVector to contain the 
	// desired movement. The vector gets normalized in the MobController, then the players speed property will be 
	// applied to it.
	return playerMovementVector;
}

public override void RunCameraUpdate() {
	// Work out where the camera should now be, and set Main Camera to that position/rotation
}
  }

All the class needs is the GetPlayerMovement() and RunCameraUpdate() funtions. Fill those functions with the logic to handle input and either update the playerMovementVector or update the camera's position and rotation.

Once the script has been made, add it to the MainCamera object in the MainWorld or equivalent in-game scenes, and turn off or delete the Atavism3rdPersonInputController component.

changing_the_input_controller.txt · Last modified: 2016/09/14 21:08 (external edit)