本文整理汇总了C++中LODNode::add_switch方法的典型用法代码示例。如果您正苦于以下问题:C++ LODNode::add_switch方法的具体用法?C++ LODNode::add_switch怎么用?C++ LODNode::add_switch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LODNode
的用法示例。
在下文中一共展示了LODNode::add_switch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initNodePath
void Character::initNodePath(Player *player,
CollisionTraverser *traverser,
CollisionTraverser *traverserQueue,
CollisionHandlerQueue *colliHandlerQueue,
Filename charDir,
Filename charWalkDir,
Filename charStandDir,
std::string lodNodename,
std::string colliNodeName) {
LODNode *lod = new LODNode(lodNodename);
NodePath lodNodePath(lod);
lodNodePath.reparent_to(player->getWindow()->get_render());
lod->add_switch(50, 0);
// load character and place on the grounds
NodePath character = player->getWindow()->load_model(player->getPanda()->get_models(), charDir);
character.reparent_to(lodNodePath);
character.set_scale(0.203, 0.203, 0.203);
// add collision node to character
CollisionNode *collNode = new CollisionNode(colliNodeName);
collNode->add_solid(new CollisionSphere(0, 0, 0, 2.5));
NodePath fromObj = character.attach_new_node(collNode);
CollisionHandlerPusher *colliHandlerPusher = new CollisionHandlerPusher();
colliHandlerPusher->add_collider(fromObj, character);
traverser->add_collider(fromObj, colliHandlerPusher);
traverserQueue->add_collider(fromObj, colliHandlerQueue);
// Load the walk animation
player->getWindow()->load_model(character, charStandDir);
player->getWindow()->load_model(character, charWalkDir);
// bind animation
auto_bind(character.node(), animCollection);
stopMoving();
nodePath = character;
standAnimName = animCollection.get_anim_name(0);
walkAnimName = animCollection.get_anim_name(1);
// get animation names
//for(int i = 0; i < animCollection.get_num_anims(); i++)
// cout << animCollection.get_anim_name(i) << endl;
}