Added small physics improvments

This commit is contained in:
Anderson Mancini committed 2024-01-24 09:44:28 -03:00
1 parent 6232bf9498
commit 934c26491c
3 files changed
+22 -9

No files matched your search

+1
View File
@@ -38,6 +38,7 @@ function App() {
<Suspense fallback={null}> <Suspense fallback={null}>
<Physics <Physics
gravity={[0, -90, 0]} gravity={[0, -90, 0]}
timeStep={'vary'}
> >
<KeyboardControls map={map}> <KeyboardControls map={map}>
<Experience /> <Experience />
+17 -6
View File
@@ -1,12 +1,23 @@
import { RigidBody } from "@react-three/rapier"; import { RigidBody } from '@react-three/rapier'
export const Ground = (props) => { export const Ground = (props) => {
return ( return (
<RigidBody type="fixed" {...props}> <RigidBody
<mesh transparent receiveShadow rotation={[-Math.PI/2 , 0 ,0]}> type='fixed'
{...props}
>
<mesh
transparent
receiveShadow
rotation={[-Math.PI / 2, 0, 0]}
>
<planeGeometry args={[1000, 1000, 1000]} /> <planeGeometry args={[1000, 1000, 1000]} />
<meshStandardMaterial color="yellow" opacity={0} transparent/> <meshStandardMaterial
color='yellow'
opacity={0}
transparent
/>
</mesh> </mesh>
</RigidBody> </RigidBody>
); )
}; }
+4 -3
View File
@@ -239,7 +239,7 @@ export const PlayerController = () => {
// SOUND WORK // SOUND WORK
// console.log(body.current.translation()) // console.lowg(body.current.translation())
}) })
return ( return (
@@ -250,6 +250,7 @@ export const PlayerController = () => {
position={[8, 20, -96]} position={[8, 20, -96]}
centerOfMass={[0, -1, 0]} centerOfMass={[0, -1, 0]}
mass={3} mass={3}
ccd
> >
<BallCollider <BallCollider
args={[0.5]} args={[0.5]}
@@ -258,10 +259,10 @@ export const PlayerController = () => {
isOnFloor.current = true isOnFloor.current = true
}} }}
/> />
onCollisionEnter= {/* onCollisionEnter=
{(event) => { {(event) => {
isOnFloor.current = false isOnFloor.current = false
}} }} */}
</RigidBody> </RigidBody>
<group <group