triangleselector problems

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Cleves
Posts: 224
Joined: Mon Sep 08, 2003 6:40 pm

triangleselector problems

Post by Cleves »

Hey guys

My app compiles ok but when i run the program it's says that my setTriangleSelector has a Access violation.
I tried a lot of thing, i spent half a day trying to fix it.
I hope you can help me, here is my code where the problem occured:
ISceneNode* node2;
IAnimatedMeshSceneNode* anms = smgr->addAnimatedMeshSceneNode(smgr->getMesh("Data/ast.ms3d"));
IAnimatedMesh* ast = smgr->getMesh("Data/ast.ms3d");


if (node2)
{
anim = smgr->createFlyStraightAnimator(vector3df(-2000,-230,-1249),
core::vector3df(40000,100,-700), 50000, false);
anms->setMaterialTexture(0, driver->getTexture("Data/ast.bmp"));
anms->addAnimator(anim);
anim->drop();
anms->setMaterialFlag(EMF_LIGHTING, false);
anms->setAnimationSpeed(10);

selector = smgr->createOctTreeTriangleSelector(ast->getMesh(0), node2, 128);
node2->setTriangleSelector(selector);
selector->drop();

anim = smgr->createCollisionResponseAnimator(
selector, node2,vector3df(5,3,5),vector3df(0,-10,0), 50.0f, vector3df(0,0,7), 0.5);
node2->addAnimator(anim);
anim->drop();


};

Any ideas?

Thanks
hearsedriver
Posts: 81
Joined: Fri Aug 22, 2003 12:06 pm
Location: Germany
Contact:

Post by hearsedriver »

node2 is uninitialized and points into Nirvana, so node2->setTriangleSelector(selector); will cause a crash.

Cheers.
matthias gall, lead programmer at sechsta sinn - email matthias@sechsta-sinn.de
Cleves
Posts: 224
Joined: Mon Sep 08, 2003 6:40 pm

Post by Cleves »

(Smacks himself in the head) i forgot about it!! thanks Matthias.

mmmm...but now that i init node2 everything goes strange the animation dosen't work and the object is black..weird
Post Reply