diff --git a/src/components/FakeFlame/FakeFlame.jsx b/src/components/FakeFlame/FakeFlame.jsx index 9893781..086ca7c 100644 --- a/src/components/FakeFlame/FakeFlame.jsx +++ b/src/components/FakeFlame/FakeFlame.jsx @@ -7,7 +7,7 @@ import { shaderMaterial } from '@react-three/drei' import { extend, useFrame } from '@react-three/fiber' import { Color, DoubleSide, AdditiveBlending } from 'three' -export default function FakeFlame({ falloff = 10, glowInternalRadius = 1.0, glowColor = 'orange', glowSharpness = 1.0 , isBoosting,}) { +export default function FakeFlame({ falloff = 3, glowInternalRadius = 1.0, glowColor = 'orange', glowSharpness = 1.0 , isBoosting,}) { const FakeFlame = useMemo(() => { return shaderMaterial( { @@ -39,10 +39,10 @@ export default function FakeFlame({ falloff = 10, glowInternalRadius = 1.0, glow float glitchStrength = sin(glitchTime) + sin(glitchTime * .05) + sin(glitchTime * .36); glitchStrength /= 2.0; glitchStrength = smoothstep(0.2, 0.8, glitchStrength); - glitchStrength *= 0.; + glitchStrength *= 0.05; modelPosition.x += (random2D(modelNormal.xx + time) - 0.5) * glitchStrength; modelPosition.x += (random2D(modelNormal.xx - time) - 0.2) * glitchStrength; - modelPosition.y += sin(smoothstep(0.3, vUv.y - 1.8, position.y) * 2.) * sin(time * 24.); + modelPosition.y += sin(smoothstep(0.3, vUv.y - 2.2, position.y) * 2.) * sin(time * 48.); modelPosition.z += sin(smoothstep(0., vUv.x - 0.8, position.z) * 2.) * sin(time * 24.) * .6; gl_Position = projectionMatrix * viewMatrix * modelPosition; @@ -107,7 +107,7 @@ export default function FakeFlame({ falloff = 10, glowInternalRadius = 1.0, glow q.x *= 2.; q.y *= 2.; float strength = floor(q.x+1.5); - float T3 = max(2.,2.25*strength)*time; + float T3 = max(2.,2.25*strength)*time * 3.; q.x = mod(q.x,1.)-0.5; q.y -= 0.05; float n = fbm(strength*q + vec2(0,T3)); diff --git a/src/components/PlayerController.jsx b/src/components/PlayerController.jsx index a8ff2dd..50b22b9 100644 --- a/src/components/PlayerController.jsx +++ b/src/components/PlayerController.jsx @@ -209,15 +209,22 @@ export const PlayerController = () => { // RELEASING DRIFT if (boostDuration.current > 1 && !jumpIsHeld.current) { - setCurrentSpeed(boostSpeed) - boostDuration.current -= 1 * delta * 144 - targetZPosition = 10 setIsBoosting(true) } else if (boostDuration.current <= 1) { targetZPosition = 8 setIsBoosting(false) } + if(isBoosting && boostDuration.current > 1){ + setCurrentSpeed(boostSpeed) + boostDuration.current -= 1 * delta * 144 + targetZPosition = 10 + } else if (boostDuration.current <= 1) { + setIsBoosting(false) + targetZPosition = 8 + } + + // CAMERA WORK cam.current.updateMatrixWorld() diff --git a/src/components/models/Mario_kart.jsx b/src/components/models/Mario_kart.jsx index 4cd8c68..b7489b2 100644 --- a/src/components/models/Mario_kart.jsx +++ b/src/components/models/Mario_kart.jsx @@ -16,7 +16,8 @@ export function Mario({ currentSpeed, steeringAngleWheels, isBoosting, ...props const frontRightWheel = useRef() const rearWheels = useRef() const frontWheels = useRef() - const [scale, setScale] = React.useState(0) + const [scale, setScale] = React.useState(1) + // isBoosting = true; useFrame((_,delta) => { const rotation = currentSpeed / 100