diff options
author | Stijn Buys <ingar@osirion.org> | 2011-01-26 15:56:10 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-01-26 15:56:10 +0000 |
commit | c3182222bd3fef6009f98205c0203d61a7509b11 (patch) | |
tree | 32046ab6ae2d54f0930f8d5289f45a6807874635 /src/core | |
parent | 035653e94a3d74b8f18c993034199d7cd08a895a (diff) |
Corrected the origin alignment of collision mesh bodies.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/entity.cc | 9 |
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 |