private void Update() { // Retrieves input values from player forwardInput = PlayerInputHandler.GetForwardInput(); rotationalInput = PlayerInputHandler.GetRotationalInput(); // Applies clamped velocity to ensure player doesn't exceed max speed rigidbody.velocity = Vector3.ClampMagnitude(rigidbody.velocity, maxSpeed); }
private void Update() { // Play the particle effect only when the player is moving forward if (PlayerInputHandler.GetForwardInput() > 0) { if (flare.isStopped) { flare.Play(); } } else { if (flare.isPlaying) { flare.Stop(); } } }