diff --git a/public/sounds/engine.wav b/public/sounds/engine.wav
new file mode 100644
index 0000000..5c13d50
Binary files /dev/null and b/public/sounds/engine.wav differ
diff --git a/src/components/FlameParticle.jsx b/src/components/FlameParticle.jsx
index 2ddd788..4f1f484 100644
--- a/src/components/FlameParticle.jsx
+++ b/src/components/FlameParticle.jsx
@@ -25,7 +25,7 @@ export const FlameParticle = ({ position, png, turboColor, delay = 0 }) => {
return geom;
}, [position]);
- useFrame(() => {
+ useFrame(({clock}) => {
if (!initialized) return;
pointsRef.current.position.y += 0.03;
diff --git a/src/components/PlayerController.jsx b/src/components/PlayerController.jsx
index 8609609..cb3b971 100644
--- a/src/components/PlayerController.jsx
+++ b/src/components/PlayerController.jsx
@@ -6,6 +6,8 @@ import {
ContactShadows,
Sphere,
OrbitControls,
+ Trail,
+ PositionalAudio,
} from "@react-three/drei";
import { useFrame, useThree } from "@react-three/fiber";
import { useRef, useState, useEffect, useCallback } from "react";
@@ -63,6 +65,7 @@ export const PlayerController = () => {
let targetXPosition = 0;
let targetZPosition = 8;
const [steeringAngleWheels, setSteeringAngleWheels] = useState(0);
+ const engineSound = useRef();
const [scale, setScale] = useState(0);
@@ -264,7 +267,7 @@ export const PlayerController = () => {
boostDuration.current -= 1;
targetZPosition = 10;
setIsBoosting(true);
- } else if (boostDuration.current <= 1) {
+ } else if (boostDuration.current <= 1 ) {
targetZPosition = 8;
setIsBoosting(false);
}
@@ -296,6 +299,11 @@ export const PlayerController = () => {
// Update the kart's rotation based on the steering angle
setSteeringAngleWheels(steeringAngle * 25);
+
+ // SOUND WORK
+
+
+ console.log(body.current.translation())
});
return (
@@ -303,7 +311,7 @@ export const PlayerController = () => {
@@ -320,7 +328,7 @@ export const PlayerController = () => {
}}
-
+
{
fov={50}
ref={cam}
/>
+ {/* */}
+
);