How to place a node under the mouse pointer?

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
Serg Nechaeff
Posts: 162
Joined: Wed Nov 26, 2003 5:24 pm
Location: Europe

How to place a node under the mouse pointer?

Post 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?
http://www.javazing.com
P-III-950, WinXP, GeForce FX5600 128 MB ForceWare 52.16, DX9, Eclipse IDE, JRE 1.6
Boogle
Posts: 162
Joined: Fri Nov 21, 2003 3:16 pm
Location: Toronto, Canada

Post 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).
Serg Nechaeff
Posts: 162
Joined: Wed Nov 26, 2003 5:24 pm
Location: Europe

Post by Serg Nechaeff »

Thanks a lot!
http://www.javazing.com
P-III-950, WinXP, GeForce FX5600 128 MB ForceWare 52.16, DX9, Eclipse IDE, JRE 1.6
mariusz_p
Posts: 15
Joined: Tue Jan 06, 2004 9:37 pm

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

Post 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:
Serg Nechaeff
Posts: 162
Joined: Wed Nov 26, 2003 5:24 pm
Location: Europe

Post by Serg Nechaeff »

Oh god, I KNEW I saw it somewhere :) thanx!
http://www.javazing.com
P-III-950, WinXP, GeForce FX5600 128 MB ForceWare 52.16, DX9, Eclipse IDE, JRE 1.6
Post Reply