Skip to content

Commit 7c99219

Browse files
committed
fix: Mesh entity read collider properties
1 parent 2f88dfe commit 7c99219

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

back/src/ecs/entity/Mesh.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
PhysicsPropertiesComponent,
1313
PhysicsPropertiesComponentData,
1414
} from '../component/physics/PhysicsPropertiesComponent.js'
15-
import { ColliderPropertiesComponentData } from '../component/physics/ColliderPropertiesComponent.js'
15+
import {
16+
ColliderPropertiesComponent,
17+
ColliderPropertiesComponentData,
18+
} from '../component/physics/ColliderPropertiesComponent.js'
1619
import { ConvexHullColliderComponent } from '../component/physics/ConvexHullColliderComponent.js'
1720

1821
export interface MeshParams {
@@ -51,7 +54,7 @@ export class Mesh {
5154
entity: Entity
5255

5356
constructor(params: MeshParams) {
54-
const { position, meshUrl, physicsProperties } = params
57+
const { position, meshUrl, physicsProperties, colliderProperties } = params
5558

5659
this.entity = EntityManager.createEntity(SerializedEntityType.CUBE)
5760

@@ -72,6 +75,9 @@ export class Mesh {
7275
)
7376
this.entity.addComponent(serverMeshComponent)
7477

78+
this.entity.addComponent(
79+
new ColliderPropertiesComponent(this.entity.id, colliderProperties ?? {})
80+
)
7581
this.entity.addComponent(
7682
new ConvexHullColliderComponent(
7783
this.entity.id,

0 commit comments

Comments
 (0)