Ive been trying to solve this out for few hours and it's driving me nuts.
LoadMapWithCollision function:
Code: Select all
int LoadMapWithCollision(char mapfilename[100], char texturefilename[100], int mapposx, int mapposy, int mapposz, int scenenodeindex, int radiusx, int radiusy, int radiusz)
{
mapmesh = smgr->getMesh(mapfilename);
mapnode = 0;
mapnode = smgr->addOctTreeSceneNode(mapmesh->getMesh(0));
mapnode->setMaterialFlag(EMF_LIGHTING, false);
mapnode->setMaterialTexture(0, driver->getTexture(texturefilename) );
mapnode->setPosition(core::vector3df(mapposx,mapposy,mapposz));
selector = smgr->createOctTreeTriangleSelector(mapmesh->getMesh(0), mapnode, 128);
mapnode->setTriangleSelector(selector);
anim = smgr->createCollisionResponseAnimator(selector, anim_node[scenenodeindex], core::vector3df(radiusx,radiusy,radiusz),core::vector3df(0,0,0),core::vector3df(0,50,0));
anim_node[scenenodeindex]->addAnimator(anim);
anim->drop();
}
LoadMapWithCollision("testmodel.ms3d", "texture.bmp", -100, 0, 0, ptr, 30,50,30);
ptr is index of my IAnimatedMeshSceneNode array.
So basically Im trying to load model, and make another model to collide with it (zombie02.ms3d model with texture 'zombie.jpg')
testmodel.ms3d loads fine with texture, and the other model (which should collide with testmodel) is loaded too.
Somehow they dont however collide.
Cmd line says following:
Irrlicht Engine version 1.5
Microsoft Windows Vista Personal Service Pack 1 (Build 6001)
Using renderer: OpenGL 2.1.2
GeForce 9800 GTX/9800 GTX+/PCI/SSE2: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
GLSL version: 1.3
Loaded texture: C:\Users\veepee\Desktop\Cottage\Zombie.jpg
Loaded mesh: zombie02.ms3d
Loaded mesh: testmodel.ms3d
Needed 0ms to create OctTree SceneNode.(13 nodes, 938 polys)
Loaded texture: C:\Users\veepee\Desktop\Cottage\texture.bmp
Needed 0ms to create OctTreeTriangleSelector.(9 nodes, 938 polys)
Everything appears to be fine, no errors or anything. Both models show up, but they just dont collide.
EDIT. Could this problem be related to the radius?
Is the radius, the collision radius from "map" or "object which collides to the map"?
As my map is huge, if it's map's collision radius, Id have to set the radius huge.
If the radius is my object's radius, it would be small since my object model is small.