From 2aea4a37f8007d429132b9b83da3dda7482be67e Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 30 Mar 2011 16:39:27 +0000 Subject: Corrected func_move submodel instancing. --- src/model/mapfile.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/model') diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 8f8e87c..20d4c5c 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -1172,7 +1172,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t group->set_type(class_type); // these fragmentgroups are on the same level as worldspawn (no submodels) - // their axis is always the default + // their rotation axis is always identity switch (class_type) { case FragmentGroup::None: @@ -1805,16 +1805,17 @@ Model * MapFile::load(std::string const &name) for (Model::Groups::iterator git = submodel_model->groups().begin(); git != submodel_model->groups().end(); git++) { FragmentGroup *groupsrc = (*git); FragmentGroup *groupdst = new FragmentGroup(); - - groupdst->set_movement(groupsrc->movement()); + groupdst->set_type(groupsrc->type()); groupdst->set_scale(groupsrc->scale() * tag_submodel->scale()); groupdst->set_engine(groupsrc->engine()); groupdst->set_speed(groupsrc->speed()); - + groupdst->set_movement(groupsrc->movement()); + groupdst->set_distance(groupsrc->distance()); + groupdst->set_location(tag_submodel->location() + tag_submodel->axis() * (groupsrc->location() - submodel_model->origin()) * tag_submodel->scale()); groupdst->set_axis(tag_submodel->axis() * groupsrc->axis()); - + // copy fragments, this only copies the original fragment's pointer into the vertex array for (FragmentGroup::Fragments::const_iterator fit = groupsrc->fragments().begin(); fit != groupsrc->fragments().end(); fit++) { @@ -1933,6 +1934,9 @@ Model * MapFile::load(std::string const &name) Triangle *triangle = (*it); collisionmesh->add_triangle(triangle->v0() - map_center, triangle->v1() - map_center, triangle->v2() - map_center); } + + // TODO merge submodel collision meshes + // seperate collision meshes for movers // register the mesh CollisionMesh::add(collisionmesh); -- cgit v1.2.3