Skip to content

Commit

Permalink
KOTOR: Attach heads of segmented creature models
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Jan 29, 2014
1 parent 4981876 commit aa23f01
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/engines/kotor/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,31 @@ void Creature::loadModel() {
throw;
}

if (!headModel.empty()) {
Graphics::Aurora::Model_KotOR *head = 0;

try {
head = createWorldModel(headModel);
} catch (Common::Exception &e) {
e.add("Failed to load head model for creature \"%s\" (\"%s\")", _tag.c_str(), _name.c_str());
Common::printException(e, "WARNING: ");
}

if (head) {
// Reset the head's orientation, since it'll inherit it from the headhook node on the body
head->setBaseOrientation(0.0, 1.0, 0.0, 0.0);
head->setOrientation(0.0, 1.0, 0.0, 0.0);

try {
_model->addToNode(head, "headhook");
} catch (Common::Exception &e) {
destroyModel(head);
e.add("Failed to attach head \"%s\" to creature \"%s\" (\"%s\")", headModel.c_str(), _tag.c_str(), _name.c_str());
Common::printException(e, "WARNING: ");
}
}
}

_modelIDs.push_back(_model->getID());

if (!isStatic())
Expand Down

0 comments on commit aa23f01

Please sign in to comment.