Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/entity.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 9275477..cf005a0 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -511,11 +511,14 @@ void Entity::reset()
if (flag_is_set(Complex) && model()->collisionmesh()) {
// use collision mesh
- btBvhTriangleMeshShape *mesh = new btBvhTriangleMeshShape(model()->collisionmesh()->triangles(), true, true);
- entity_collision_shape = mesh;
+ btBvhTriangleMeshShape *meshshape = new btBvhTriangleMeshShape(model()->collisionmesh()->triangles(), true, true);
+ meshshape->buildOptimizedBvh();
+ meshshape->recalcLocalAabb();
btVector3 modelscalevec(modelscale, modelscale, modelscale);
- mesh->setLocalScaling(modelscalevec);
+ meshshape->setLocalScaling(modelscalevec);
+
+ entity_collision_shape = meshshape;
} else {
// use bounding box