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!!!
MOUSE CONTROL
can you be a little more specific_
irrlicht game character project
http://picasaweb.google.com/juliusctw/FinishedArt
http://picasaweb.google.com/juliusctw/FinishedArt
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
Please suggest some methods to help me! THANKS
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
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.
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!
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!
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
http://irrlicht.sourceforge.net/phpBB2/ ... de=results
Hm the results don't how. Make the search by yourself using "getRayFromScreenCoordinates" as the keyword
Calin