Game Development Community

GuiTSCtrl::unproject

by Avid Gamer · in Torque Game Engine · 08/21/2008 (9:46 am) · 4 replies

I would like some assistance in understanding this function. After searching, and fiddling for the past few days, I have not reached my desired result.

I have created a custom gui control which inherits from GuiTSCtrl. In this control I render client side only objects. My goal is to have a rendering window for editing objects' sizes, shapes, etc. that will be only client side and very light weight.

I would simply like to know how to get the 3D position of a click on a 2D control. After looking into EditTSCtrl::make3DMouseEvent and the subsequent call to GuiTSCtrl::unproject, I have found that it produces a normalized Point3F and not the actual position. I thought maybe I could multiply that Point3F by the camera's FOV along with the controls extents, but the numbers are still off. Any advice or even a point in the right direction would be highly appreciated.

A screen shot of my current work, to hopefully give a better understanding. I would like to simply click a sphere:

www.wes-x.com/images/unproject.jpg

About the author

I'm enthusiastic about learning new things and love to make things work.

Recent Threads

  • Unallocated Block
  • Profiler

  • #1
    08/21/2008 (9:56 am)
    Check out the object selection resource
    #2
    08/21/2008 (10:14 am)
    Thank you Orion.

    Seems I was very close, just needed to think a little less. I appreciate your assistance.
    #3
    08/22/2008 (2:16 pm)
    Although object Selection is not what I needed, it gave me an idea of the code I needed to write. Again, I appreciate the point in the right direction. A video of my non-sim/scene object creation and selection in the custom GUI control.

    #4
    08/22/2008 (3:02 pm)
    That's pretty cool !
    glad the selection code helped.