How to get a 3D scene node's 2D coordinates on the screen?

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
jerrelDulay
Posts: 15
Joined: Tue Nov 02, 2010 4:49 am

How to get a 3D scene node's 2D coordinates on the screen?

Post by jerrelDulay »

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!
blAaarg
Posts: 94
Joined: Tue Mar 02, 2010 9:11 pm
Location: SoCal

Post by blAaarg »

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.
"Computers don't make mistakes! What they do they do on purpose!!"

-Dale Gribble
jerrelDulay
Posts: 15
Joined: Tue Nov 02, 2010 4:49 am

Post by jerrelDulay »

Thanks mate! I had checked countless other class references in the API, and the last place I expected to find it was in the "ISceneCollisionManager". I really appreciate it! Thanks!
Post Reply