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 thePlayerInput
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 thePlayerRotationInput
class, assigning thePlayerInput
Methods
public void OnUpdate()
: Called every frame, callsSendRotationInput
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