Heya everyone. I've searched through pages of the forum and failed to find a similar topic. What I'm trying to do is get the 2D coordinates of a scene node.
For example, I have a 3rd person game engine, and I want to draw, let's say, an arrow sprite above an NPC that the player can talk to. Also, I'd need to be able to check if that scene node is outside or inside the current viewing frame.
I really just need the X and Y coordinates of where a scene node appears on the screen.
I've been able to do this in Ultimate 3D and Game Maker, I'm not entirely sure how to do this in Irrlicht. Any help would be extremely appreciated!
Cheers!
How to get a 3D scene node's 2D coordinates on the screen?
-
- Posts: 15
- Joined: Tue Nov 02, 2010 4:49 am
Don't forget to check the API for ISceneCollisionManager Class Reference
It has several useful methods including the one you want: getScreenCoordinatesFrom3DPosition(). Keep in mind, the position returned is the "local" or "model" coordinates of the mesh and you'll have to figure out how to offset the arrow sprite accordingly.
The scene node will have a method isCulled() which will tell you if its bounding box is completely invisible to the camera, iirc.
It has several useful methods including the one you want: getScreenCoordinatesFrom3DPosition(). Keep in mind, the position returned is the "local" or "model" coordinates of the mesh and you'll have to figure out how to offset the arrow sprite accordingly.
The scene node will have a method isCulled() which will tell you if its bounding box is completely invisible to the camera, iirc.
"Computers don't make mistakes! What they do they do on purpose!!"
-Dale Gribble
-Dale Gribble
-
- Posts: 15
- Joined: Tue Nov 02, 2010 4:49 am