Player Movement Input

The PlayerMovementInput class is responsible for the player's movement inputs, translating them into movement commands that are sent to the server.

Properties

  • private PlayerInput playerInput: References the PlayerInput instance.

  • private Vector3 targetDirection: Represents the target direction that player is moving towards.

  • private Vector3 forward: Represents the forward vector that the player is looking at.

  • private Vector3 right: Represents the right vector of the player.

  • private Transform cameraTransform: Represents the transform of the main camera.

Constructor

  • public PlayerMovementInput(PlayerInput playerInput): Initializes a new instance of the PlayerMovementInput class, assigning the PlayerInput and getting the main camera's transform.

Methods

  • public void OnUpdate(): Called every frame, calls SendMovementInput

  • private void SendMovementInput(): Processes the movement input. If there is movement input, it calculates the direction based on the camera's orientation and sends a movement request to the server with the calculated direction.

Last updated