Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
fix rigidbody crash server (#10891)
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField authored Aug 6, 2024
1 parent 3c49106 commit 3e509e0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/spatial/src/physics/components/RigidBodyComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { Types } from 'bitecs'
import { useEntityContext } from '@etherealengine/ecs'
import {
defineComponent,
hasComponent,
removeComponent,
setComponent,
useComponent
Expand Down Expand Up @@ -123,6 +124,7 @@ export const RigidBodyComponent = defineComponent({
component.initialized.set(true)
return () => {
Physics.removeRigidbody(physicsWorld, entity)
if (!hasComponent(entity, RigidBodyComponent)) return
component.initialized.set(false)
}
}, [physicsWorld])
Expand Down

0 comments on commit 3e509e0

Please sign in to comment.