Is there any API in the game engine can convert the mouse coordinate to world space coordinate??
I mean like glUnProject in OpenGL.
This is because I am develop a game which need the player to click on screen to build things on the map.
Thxs a lot for the one who can answer.
[Urgent] API for mouse coordinate to world coordinate
-
williamlai3a
- Posts: 13
- Joined: Wed Sep 19, 2007 11:57 am
-
rogerborg
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
What's so [Urgent] about this? 
Use ISceneCollisionManager::getRayFromScreenCoordinates() to create a ray.
Then either use ISceneNodeCollisionManager::getSceneNodeFromRayBB() to find the nearest scene node that the ray intersects.
And/or ISceneNodeCollisionManager::getCollisionPoint() to find the intersection of the ray and a triangle selector (or a collection of triangle selectors held in a meta triangle selector).
See example 07. Collision for usage of these.
Alternatively, you may need to collide the ray with a plane. Create a suitable core::plane3df() and then use plane3d::getIntersectionWithLine() or plane3d::getIntersectionWithLimitedLine() to find the intersection point.
If you need [Urgent] help, then Irrlicht's IRC channel is a good place to ask.
Use ISceneCollisionManager::getRayFromScreenCoordinates() to create a ray.
Then either use ISceneNodeCollisionManager::getSceneNodeFromRayBB() to find the nearest scene node that the ray intersects.
And/or ISceneNodeCollisionManager::getCollisionPoint() to find the intersection of the ray and a triangle selector (or a collection of triangle selectors held in a meta triangle selector).
See example 07. Collision for usage of these.
Alternatively, you may need to collide the ray with a plane. Create a suitable core::plane3df() and then use plane3d::getIntersectionWithLine() or plane3d::getIntersectionWithLimitedLine() to find the intersection point.
If you need [Urgent] help, then Irrlicht's IRC channel is a good place to ask.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
