Game Development Community

3D world coordinates to GUI coordinates

by Mike Kloeppner · in Torque Game Engine · 02/22/2008 (2:01 pm) · 3 replies

Hey all, I'm working on a project that requires a HUD to be displayed on the gui layer for a DTS shape in my scene.

Basically: When you click on the object and thus 'select' it, it's HUD appears. This HUD needs to follow (stick to) the DTS object updating its position relative the related positions of the player and the object. The HUD must also be on the GUI layer, and NOT within the scene itself.

(simular to the demo FPS which displays the 'name' above the players head, except that this must instead be done from within the GUI layer. )

In order to do this, I imagine I'll have to convert the 3D position of the object to a 2D position on the GUI layer.

The problem: is math. I've attempted using several equations including such information as eyeVector, forward Vector, XYZ positions and distance. But exactly where and how this info needs to be caculated together in beyond me.

Question: Has anyone ever seen or done anything like this before? If so, any leads on this issue would be very much appreciated.

thanks,

-mike kloeppner

#1
02/22/2008 (2:26 pm)
It sounds like you might be looking for exactly the Gui3DProjectionCtrl.
#2
02/22/2008 (3:58 pm)
Yep, great resource Orion.

I only had to change some outdated paths and it build without any errors, except it will not run.

I'm clicking on torqueDemo_DEBUG.exe and it fails and this little windows message pops up:

GuiControl: (null) created with no profile.

I'm thinking that there is something very simple that I'm missing here, any ideas? ever heard of this?
#3
02/22/2008 (4:56 pm)
(replying in resource)