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!
Munku
Posts: 66 Joined: Tue Nov 30, 2004 4:04 pm
Post
by Munku » Tue Jan 18, 2005 5:46 pm
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 » Tue Jan 18, 2005 5:53 pm
You aren't saving the return value from getCollisionPoint() ?
Munku
Posts: 66 Joined: Tue Nov 30, 2004 4:04 pm
Post
by Munku » Tue Jan 18, 2005 6:05 pm
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 » Tue Jan 18, 2005 6:13 pm
How are you creating the triangle selector?
Morrog
Posts: 58 Joined: Mon Dec 13, 2004 5:13 am
Post
by Morrog » Wed Jan 19, 2005 2:05 am
doesn't look like he is from that code.
Munku
Posts: 66 Joined: Tue Nov 30, 2004 4:04 pm
Post
by Munku » Wed Jan 19, 2005 1:32 pm
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