A Nasty Crash

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Munku
Posts: 66
Joined: Tue Nov 30, 2004 4:04 pm

A Nasty Crash

Post by Munku »

This is what I am trying to do: get the *exact* coords from mouse to screen on a button click.

This is the code I am using:

Code: Select all

    vector3df target,location;
     triangle3df tri;
     line3d<f32> ray;
     ITriangleSelector *tSelector;
     ISceneCollisionManager *colMgr = smgr->getSceneCollisionManager();
     position2d<s32> cPos;
     ICameraSceneNode *cam;
     
   if (event.isLeftMouseDown() == true)
   {
     cam = smgr->getActiveCamera();
     cPos = rwnd->getCursorControl()->getPosition();
     ray = colMgr->getRayFromScreenCoordinates(cPos,cam);
     colMgr->getCollisionPoint(ray,tSelector,target,tri);      
   }

Alright, when the program executes the getCollisionPoint it crashes with a seg fault. Anyone see a problem with this code? I've checked and the colMgr, Ray, cam and cPos are not 0/NULL.
Umm, don't look at me that way. I'M not the dead one here.

--The One True Marshmellow
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

You aren't saving the return value from getCollisionPoint() ?
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
Munku
Posts: 66
Joined: Tue Nov 30, 2004 4:04 pm

I would be

Post by Munku »

I would be, but unfortunatly, it crashes on GetCollisionPoint. I omitted the return to try and get it to work. I know I need it ;)
Umm, don't look at me that way. I'M not the dead one here.

--The One True Marshmellow
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

How are you creating the triangle selector?
Morrog
Posts: 58
Joined: Mon Dec 13, 2004 5:13 am

Post by Morrog »

doesn't look like he is from that code.
Munku
Posts: 66
Joined: Tue Nov 30, 2004 4:04 pm

Gods...

Post by Munku »

By the Gods I am stupid :)

Thanks, I thought I was forgetting something important :).
Umm, don't look at me that way. I'M not the dead one here.

--The One True Marshmellow
Post Reply