diff options
author | Stijn Buys <ingar@osirion.org> | 2011-05-06 18:27:55 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-05-06 18:27:55 +0000 |
commit | 50947891a97f19fa11f9f073c8988156f9655d97 (patch) | |
tree | 2373dd39d70edd7995210aabb6973315465ba737 /src/model/mapfile.cc | |
parent | e7a0b54c4717afdfa12a8847d5bc72b7b68290b4 (diff) |
Support for func_rotate and func_move collision meshes.
Diffstat (limited to 'src/model/mapfile.cc')
-rw-r--r-- | src/model/mapfile.cc | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 0abbdbd..270d63f 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -1317,8 +1317,36 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t } // apply vertexgroup params to the collision mesh - collisionmesh->set_params(group); - + collisionmesh->set_location(translation); + collisionmesh->set_type(class_type); + + // these fragmentgroups are on the same level as worldspawn (no submodels) + // their rotation axis is always identity + + switch (class_type) { + case FragmentGroup::None: + break; + + case FragmentGroup::Rotate: + if (class_speed == 0) { + // default rotation speed 45 degrees per second + class_speed = 45.0f; + } + collisionmesh->set_speed(class_speed); + collisionmesh->set_movement(class_axis.forward()); + break; + + case FragmentGroup::Move: + group->set_speed(class_speed); + group->set_distance(class_distance); + group->set_movement(class_axis.forward()); + break; + + case FragmentGroup::Door: + group->set_speed(class_speed); + break; + } + // add the collision mesh to the collision model model->collisionmodel()->add_mesh(collisionmesh); } |