Any ideas on this would be greatly appreciated. I am upgrading to irrlicht 1.6 from 1.5.1, and thought I'd change some of my code to use the new ISeneCollisionManager::getSceneNodeAndCollisionPointFromRay() function. Unfortunately my program dies when it calls this function. At the moment I'm stumped.
Here's a code snippet:
Code: Select all
core::line3d<f32> line;
line.start = mainCamera->getAbsolutePosition();
line.end = line.start + (mainCamera->getTarget() - line.start).normalize() * 1000.0f;
core::vector3df intersection;
core::triangle3df tri;
cout<<"Before collision check"<<endl;
printf("Line=(%4.2f,%4.2f,%4.2f)-(%4.2f,%4.2f,%4.2f)\n",line.start.X,line.start.Y,line.start.Z,line.end.X,line.end.Y,line.end.Z);
const core::list< ISceneNode * > children = CollidableNodes->getChildren();
printf("CollidableNodes contains %d children nodes\n",children.getSize());
pause();
if (irrScene->getSceneCollisionManager()->getSceneNodeAndCollisionPointFromRay(
line, intersection, tri, 0, CollidableNodes, false))
{
cout<<"5";
pause();
bill->setPosition(intersection);
irrDriver->setTransform(video::ETS_WORLD, core::matrix4());
irrDriver->setMaterial(material);
irrDriver->draw3DTriangle(tri, video::SColor(0,255,0,0));
}
cout<<"5";
pause();
When I run the program it gets to the debug lines just before the if condition, pauses for me so I can read the output, then the program simply exits. No crash or anything, it just disappears. Nothing is rendered, and it never reaches the other pause() lines just inside, or just after the if block.
Here's a sample of the output:
Code: Select all
Initializing application...
Initializing irrlicht...
Irrlicht Engine version 1.6
Microsoft Windows XP Professional Service Pack 3 (Build 2600)
Using renderer: OpenGL 1.3.1030
FireMV 2400 PCI DDR x86/SSE2: ATI Technologies Inc.
OpenGL driver version is 1.2 or better.
GLSL not available.
Initializing Scene...
Loaded texture: C:\Projects\STEVE\Megaverse\media\tex\brick42.jpg
Loaded texture: C:\Projects\STEVE\Megaverse\media\img\stars1.bmp
Could not open file of texture: C:\Projects\STEVE\Megaverse\media\model/Con10.jpg
Could not open file of texture: C:\Projects\STEVE\Megaverse\media\model/CorrugatedMetal.jpg
Loaded mesh: media/model/hangar.obj
Loaded texture: C:\Projects\STEVE\Megaverse\media\tex\con10.jpg
Loaded texture: C:\Projects\STEVE\Megaverse\media\tex\corrugatedmetal.jpg
Could not open file of texture: C:\Projects\STEVE\Megaverse\media\model/ALUM_8L4.JPG
Could not open file of texture: C:\Projects\STEVE\Megaverse\media\model/SafetyChevron.jpg
Could not open file of texture: C:\Projects\STEVE\Megaverse\media\model/PlatNum29.jpg
Loaded mesh: media/model/ground.obj
Loaded texture: C:\Projects\STEVE\Megaverse\media\tex\alum_8l4.jpg
Loaded texture: C:\Projects\STEVE\Megaverse\media\tex\safetychevron.jpg
Loaded texture: C:\Projects\STEVE\Megaverse\media\tex\platnum29.jpg
Scenefile loaded
1b23 nodes found=11
a-root-fgi
a-testCube-bgh=0x7824760i
a-Skybox-fgi
a-Sun-fgi
a-Hangar-cgh=0x7920d58i
a-HangarLight-fgi
a-Platform-cgh=0x77e7098i
a-Platform30-cgh=0x7920b98i
a-CollidableNodes-fgi
a--fgi
a-NonCollidableNodes-fgi
4Preparing for main loop 1Loaded texture: C:\Projects\STEVE\Megaverse\media\tex\particle.bmp
2Time=803
123Before collision check
Line=(0.00,0.00,0.00)-(0.00,0.00,1000.00)
CollidableNodes contains 5 children nodes
Press return to continue:
Steve