Added small physics improvments

skidmarks
Anderson Mancini 2024-01-24 09:44:28 -03:00
parent 6232bf9498
commit 934c26491c
3 changed files with 22 additions and 9 deletions

View File

@ -38,6 +38,7 @@ function App() {
<Suspense fallback={null}>
<Physics
gravity={[0, -90, 0]}
timeStep={'vary'}
>
<KeyboardControls map={map}>
<Experience />

View File

@ -1,12 +1,23 @@
import { RigidBody } from "@react-three/rapier";
import { RigidBody } from '@react-three/rapier'
export const Ground = (props) => {
return (
<RigidBody type="fixed" {...props}>
<mesh transparent receiveShadow rotation={[-Math.PI/2 , 0 ,0]}>
<RigidBody
type='fixed'
{...props}
>
<mesh
transparent
receiveShadow
rotation={[-Math.PI / 2, 0, 0]}
>
<planeGeometry args={[1000, 1000, 1000]} />
<meshStandardMaterial color="yellow" opacity={0} transparent/>
<meshStandardMaterial
color='yellow'
opacity={0}
transparent
/>
</mesh>
</RigidBody>
);
};
)
}

View File

@ -239,7 +239,7 @@ export const PlayerController = () => {
// SOUND WORK
// console.log(body.current.translation())
// console.lowg(body.current.translation())
})
return (
@ -250,6 +250,7 @@ export const PlayerController = () => {
position={[8, 20, -96]}
centerOfMass={[0, -1, 0]}
mass={3}
ccd
>
<BallCollider
args={[0.5]}
@ -258,10 +259,10 @@ export const PlayerController = () => {
isOnFloor.current = true
}}
/>
onCollisionEnter=
{/* onCollisionEnter=
{(event) => {
isOnFloor.current = false
}}
}} */}
</RigidBody>
<group