My game is progressing and I'm ready to move on to collision detection so the player can take damage and bullets can pop enemies. I found some code in the API, but it's not working like I had hoped.
node (aka boxy) is a player controlled IAnimatedMeshSceneNode that exists in front of the camera.
borka is an enemy IAnimatedMeshSceneNode with an ISceneNodeAnimator that sends it across the screen.
What is supposed to happen - When the player and enemy touch, the player switches to a red colored texture.
Code: Select all
const core::aabbox3d<f32> boxy_coll = node->getBoundingBox();
const core::aabbox3d<f32> borka_coll = borka->getBoundingBox();
if(boxy_coll.intersectsWithBox(borka_coll)){
node->setMaterialTexture( 0, driver->getTexture("../../media/boxyred.tga") );
}else{
node->setMaterialTexture( 0, driver->getTexture("../../media/boxy.tga") );
}