Player Rotation Input

The PlayerRotationInput is responsible for the player's rotation inputs, ensuring the player character rotates in response to player commands, maintaining a correct orientation within the game world.

Properties

  • private PlayerInput playerInput: References the PlayerInput instance.

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

  • private Vector3 oldRotationDirection: Represents the old rotation direction of the player.

  • private Vector3 rotationDirection: Represents the rotation direction of the player.

Constructor

  • public PlayerRotationInput(PlayerInput playerInput): Initializes a new instance of the PlayerRotationInput class, assigning the PlayerInput

Methods

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

  • private void SendRotationInput(): Processes the rotation input. If there's a change in the movement input, it calculates the new rotation direction and sends a rotation request to the server with the calculated direction.

Last updated