From 8138f4338f4847a59f0e9703f11424b4dca77c39 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 2 Feb 2024 11:54:29 +0100 Subject: [PATCH] feat:(game) added a reset button to avoid reload --- src/components/PlayerController.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/PlayerController.jsx b/src/components/PlayerController.jsx index 17b789e..34de28f 100644 --- a/src/components/PlayerController.jsx +++ b/src/components/PlayerController.jsx @@ -397,6 +397,16 @@ export const PlayerController = () => { if(resetPressed) { body.current.setTranslation({x: 8, y: 2, z: -119}); + body.current.setLinvel({x: 0, y: 0, z: 0}); + body.current.setAngvel({x: 0, y: 0, z: 0}); + setCurrentSpeed(0); + setCurrentSteeringSpeed(0); + setIsBoosting(false); + effectiveBoost.current = 0; + setIsOnGround(false); + jumpForce.current = 0; + driftDirection.current = 0; + kart.current.rotation.y = Math.PI / 2; }