-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Mastering C++ Game Animation Programming
By :
Supporting multiple instances from multiple models was done by creating the class AssimpInstance in the model folder. Every AssimpInstance contains a smart pointer to access its base model, including the nodes and bones. Adding multiple instances of the same model requires one of two options to handle nodes and bones: using a copy of the node data structures in every instance or sharing the model’s nodes across all instances.
To avoid the duplication of all nodes in every instance, we will reuse the nodes of the model during the calculation of each final node position for the frame.
To calculate the nodes during animation in the updateAnimation() method, we iterate the channels of the clip and use the model’s corresponding node:
for (const auto& channel : animChannels) {
std::string nodeNameToAnimate =
channel->getTargetNodeName();
std:...