diff options
author | Stijn Buys <ingar@osirion.org> | 2011-05-06 16:32:55 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-05-06 16:32:55 +0000 |
commit | ebe064bf159a5c6e90f2bbe902efa16c6e654ff8 (patch) | |
tree | c15ac8d3a9c5a21ce09da1b6834ab7e9f98d9e10 /src/model/mapfile.cc | |
parent | 1687737ca713cd0baeca3cf79950ef4877640c99 (diff) |
Always use a btCompoundShape for complex collision,
added infrastructure for collision mesh animation,
minor API documentation updates
Diffstat (limited to 'src/model/mapfile.cc')
-rw-r--r-- | src/model/mapfile.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 92349c0..b05880f 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -1305,7 +1305,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t // add the vertexgroup to the model model->add_group(group); - // add collision triangles + // load collision triangles into a mesh if (map_load_clip) { if (map_collisiontriangles.size()) { CollisionMesh *collisionmesh = new CollisionMesh(); @@ -1315,7 +1315,10 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t Triangle *triangle = (*it); collisionmesh->add_triangle(triangle->v0() - translation, triangle->v1() - translation, triangle->v2() - translation); } - + + // apply vertexgroup params to the collision mesh + collisionmesh->set_params(group); + // add the collision mesh to the collision model model->collisionmodel()->add_mesh(collisionmesh); } @@ -1958,6 +1961,9 @@ Model * MapFile::load(std::string const &name) cmit != model->collisionmodel()->meshes().end(); cmit++) { collision_tris_count += (*cmit)->size(); collision_mesh_count++; + + // translate collision meshes + (*cmit)->set_location((*cmit)->location() - map_center); } con_debug << " " << mapfile.name() << " collision " << collision_tris_count << " triangles " << collision_mesh_count << " meshes" << std::endl; |