MOUSE CONTROL

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
marcoip
Posts: 5
Joined: Wed Nov 15, 2006 7:04 pm

MOUSE CONTROL

Post by marcoip »

If i want to use mouse to decide the position of the particle system event happened in the 3d space, how can i do?

Please help!!!
juliusctw
Posts: 392
Joined: Fri Apr 21, 2006 6:56 am
Contact:

Post by juliusctw »

can you be a little more specific_
marcoip
Posts: 5
Joined: Wed Nov 15, 2006 7:04 pm

Post by marcoip »

I want to take control of moving the mouse cursor into different position in the 3D space and then produce particle effect in this position of that cursor by clicking mouse button. That means if the mouse cursor is moved by the player in different position, the particle effect also can be produced in that cursor position by clicking the mouse button.


Please suggest some methods to help me! THANKS
sober
Posts: 21
Joined: Tue Nov 29, 2005 9:23 am

Post by sober »

you cannot specify the 3d position of the mouse, because you don't know how far the mouse is into the screen.
The MousePosition mapped onto your screen is on a line between the point of the mouse on the nearplane and a point on the farplane, so you need something to find out where on this line (ray) you want the particle to be.
You need something like a floor or terrain where the user clicks onto, to get a position.
To get that, you need a Ray between the far and nearplane and check where the ray hits the ground.

Edit:

You get that ray by calling getRayFromScreenCoordinates on your scenemanager ( http://irrlicht.sourceforge.net/docu/cl ... er.html#a2 ) and use the line as descriped in the collision tutorial.

Edit2:
Doh, you posted while I was editing ;)
Last edited by sober on Tue Nov 28, 2006 5:21 pm, edited 2 times in total.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

getRayFromScreenCoordinates-
http://irrlicht.sourceforge.net/docu/cl ... er.html#a2
use the same code as in the collision example to position the particle system.

also, this question has been asked lots of times, so it should be easy to find by using the search button... 10 mins of searching beats 2 weeks waiting for an answer!
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
marcoip
Posts: 5
Joined: Wed Nov 15, 2006 7:04 pm

help!!!

Post by marcoip »

I am really no idea to solve thie problem...

When I use the collision tutorial to have a testing for this purpose, I dont know how to apply on it.

Please help!!!!
pin3
Posts: 108
Joined: Fri Oct 06, 2006 8:50 pm
Contact:

Post by pin3 »

If you're still looking for help with this here's the finds from a search for getRayFromScreenCoordinates:
http://irrlicht.sourceforge.net/phpBB2/ ... de=results

Hm the results don't how. Make the search by yourself using "getRayFromScreenCoordinates" as the keyword

Calin
Post Reply