Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2011-07-22 17:22:56 +0000
committerStijn Buys <ingar@osirion.org>2011-07-22 17:22:56 +0000
commit3d9b1b6366c2941e623e23243e9291da106775a7 (patch)
tree02d25bda40cdaa546526fcdd24e4b13176e2f6b3 /src
parent459e3886be7a93c4000bd2c4edafea2c6fdddfb5 (diff)
Added comments to explain the alexandria scaling bug.
Diffstat (limited to 'src')
-rw-r--r--src/core/entity.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 53a0f95..4a6528f 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -552,7 +552,7 @@ void Entity::reset()
if (model()->collisionmodel() && model()->collisionmodel()->size()) {
- // complex collision is enabled and a valid collision model has been found
+ // a valid collision model has been found, use it to construct a compoundshape
btCompoundShape *compoundshape = new btCompoundShape();
for (model::CollisionModel::CollisionMeshes::iterator it = model()->collisionmodel()->meshes().begin();
it != model()->collisionmodel()->meshes().end(); it++) {
@@ -560,19 +560,24 @@ void Entity::reset()
model::CollisionMesh *mesh = (*it);
// generate a btCollisionShape for each model::CollisionMesh in the model::CollisionModel
- // static entities use a btBvhTriangleMeshShape
+ // static entities use a btBvhTriangleMeshShape
btBvhTriangleMeshShape *meshshape = new btBvhTriangleMeshShape(mesh->triangles(), true, true);
meshshape->setMargin(Cvar::sv_collisionmargin->value());
const float meshscale = mesh->scale() * modelscale;
const btVector3 meshscalevec(meshscale, meshscale, meshscale);
+ // TODO
+ // This does not work as advertized, it is actually the underlying mesh that
+ // gets scaled. If there are multiple entities with the same model at a different scale,
+ // the scale is set per-model instead of per-entity
+ // Note that it is still possible to reuse and rescale the same model used by an Entitycontrolable
+ // (and most likely, EntityDynamic as well)
meshshape->setLocalScaling(meshscalevec);
meshshape->buildOptimizedBvh();
meshshape->recalcLocalAabb();
// apply collision mesh properties to the btCollisionShape
- // FIXME this goes wrong with rotated entities (see alexandria)
btTransform child_transform;
child_transform.setIdentity();
child_transform.setOrigin(to_btVector3(mesh->location() * modelscale));