Okay, I have a quake level loaded (from the tuts) and I'm trying to add collision detection (the same from the tuts) to a model. I also have a FPS camera that is free, so I want to be able to go around with my FPS camera that has no collision detection and look at the model that has collision detection.
Code: Select all
bool loadMD2(video::IVideoDriver* driver, scene::ISceneManager* smgr, char* model_name, char* texture_name,
scene::ISceneNode* node, scene::ITriangleSelector* selector)
{
// Load md2 model
scene::IAnimatedMesh* mesh = smgr->getMesh(model_name);
scene::IAnimatedMeshSceneNode* model_node = smgr->addAnimatedMeshSceneNode(mesh);
// Load texture
if(model_node){
model_node->setMaterialFlag(video::EMF_LIGHTING, false);
model_node->setMaterialTexture(0, driver->getTexture(texture_name) );
// Set animation
model_node->setMD2Animation(scene::EMAT_STAND);
// Get radius of model for collision detection
core::aabbox3d<f32> box = node->getBoundingBox();
core::vector3df radius = box.MaxEdge - box.getCenter();
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator( selector, model_node
, core::vector3df(30,50,30), core::vector3df(0,-100,0), 100.0f, core::vector3df(0,50,0) );
model_node->addAnimator(anim);
anim->drop();
}
return false;
}Am I wrong in this assumption, or is there something wrong with my code?