Mouse Picking (2D to 3D coordinate)

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
sanjilyh
Posts: 8
Joined: Tue Jul 17, 2007 7:59 pm

Mouse Picking (2D to 3D coordinate)

Post by sanjilyh »

I am doing a mini game whereby player click on the screen to shoot some object down.

It is a 3D game. So when an object pop out, the game will draw a billboard to ask the player to click on it. When player click on that object, the object will fall down. The camera is static, and fix in one side.

Right now i am stuck with the mouse picking. I have no idea how to translate from 2D coordinate to 3D coordinate. I search through the forum to get some inspiration, but couldn't find any. I tried to do ray casting, but i don't know what to specified for line.start and line.end

Will anyone kind enough to give some guidance? Thank in advance
sanjilyh
Posts: 8
Joined: Tue Jul 17, 2007 7:59 pm

Post by sanjilyh »

Thank guys, I manage to solve it after reading a few post before this.

Search function don't always work, especially when you don't know what key term to find.

Great community guys! Go on!
sanjilyh
Posts: 8
Joined: Tue Jul 17, 2007 7:59 pm

Post by sanjilyh »

Ok, now i got another question.

I already knew how to do mouse picking (turning 2D coordinate to 3D coordinate)

Now, i was wondering how do i translate 3D coordinate to 2D coordinate (based on camera)

any idea? (sound like a inverse raycast)
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

maybe this is what you're looking for?
getScreenCoordinatesFrom3DPosition(...)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
sanjilyh
Posts: 8
Joined: Tue Jul 17, 2007 7:59 pm

Post by sanjilyh »

ARRR exactly!!! Thank you so much Mr Acki
Post Reply