From 50947891a97f19fa11f9f073c8988156f9655d97 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 6 May 2011 18:27:55 +0000 Subject: Support for func_rotate and func_move collision meshes. --- src/model/mapfile.cc | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'src/model/mapfile.cc') 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); } -- cgit v1.2.3