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 thePlayerInput
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 thePlayerMovementInput
class, assigning thePlayerInput
and getting the main camera's transform.
Methods
public void OnUpdate()
: Called every frame, callsSendMovementInput
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