Skip to content

Commit

Permalink
Fix mesh collider creation (#6630)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeXXik committed May 28, 2024
1 parent ca4ca94 commit 86d019d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/framework/components/collision/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,7 @@ class CollisionMeshSystemImpl extends CollisionSystemImpl {
const entityTransform = entity.getWorldTransform();
const scale = entityTransform.getScale();

if (data.model) {
const meshInstances = data.model.meshInstances;
for (let i = 0; i < meshInstances.length; i++) {
this.createAmmoMesh(meshInstances[i].mesh, meshInstances[i].node, shape, null, data.checkVertexDuplicates);
}
const vec = new Ammo.btVector3(scale.x, scale.y, scale.z);
shape.setLocalScaling(vec);
Ammo.destroy(vec);
} else if (data.render) {
if (data.render) {
const meshes = data.render.meshes;
for (let i = 0; i < meshes.length; i++) {
if (data.convexHull) {
Expand All @@ -473,6 +465,14 @@ class CollisionMeshSystemImpl extends CollisionSystemImpl {
this.createAmmoMesh(meshes[i], tempGraphNode, shape, scale, data.checkVertexDuplicates);
}
}
} else if (data.model) {
const meshInstances = data.model.meshInstances;
for (let i = 0; i < meshInstances.length; i++) {
this.createAmmoMesh(meshInstances[i].mesh, meshInstances[i].node, shape, null, data.checkVertexDuplicates);
}
const vec = new Ammo.btVector3(scale.x, scale.y, scale.z);
shape.setLocalScaling(vec);
Ammo.destroy(vec);
}

return shape;
Expand Down

0 comments on commit 86d019d

Please sign in to comment.