Page 1 of 1

How to place a node under the mouse pointer?

Posted: Thu Jan 08, 2004 9:11 pm
by Serg Nechaeff
Please help! I need to make my particle node to follow the mouse pointer. What is the best way to do that? In Blitz3D I could place a plane in front of the camera, calculate the coordinates of the collision with that plane using screen coordinates and thus taking these 3d coordinates. Will such a method work in Irrlischt? Maybe there is an easier way?

Posted: Thu Jan 08, 2004 9:21 pm
by Boogle
Get the collision manager from the scene manager (smgr->getCollisionManager()). Cast out a ray to get the line 3d line the mouse is currently over (cmgr->getRayFromScreenCoordinates(cursor->getPosition())). Then just determine how far along the ray you want to go (I suppose the same way you determined how far out to place your plane in Blitz3D).

Posted: Thu Jan 08, 2004 9:54 pm
by Serg Nechaeff
Thanks a lot!

Re: How to place a node under the mouse pointer?

Posted: Fri Jan 09, 2004 12:16 pm
by mariusz_p
Serg Nechaeff wrote:Please help! I need to make my particle node to follow the mouse pointer. What is the best way to do that? In Blitz3D I could place a plane in front of the camera, calculate the coordinates of the collision with that plane using screen coordinates and thus taking these 3d coordinates. Will such a method work in Irrlischt? Maybe there is an easier way?
You mean, like in collision example? :wink:

Posted: Fri Jan 09, 2004 1:29 pm
by Serg Nechaeff
Oh god, I KNEW I saw it somewhere :) thanx!