Game Development Community

How to pick objects in TGB?

by Russell Buxton · in Technical Issues · 01/01/2008 (10:07 pm) · 4 replies

Hello.I'm trying to pick objects with a left click of mouse and simply echo what object or objects have been clicked.I tried the mini tutorial on mouse selections but its giving me errors.It's the "pickPoint thats doing it.The error in the console says"Unable to find object: 't2dScene' attempting to call function 'pickPoint'.I don't have my folder structured like in the tutorial.I created a new project called "Working_Project" in my "Torque\Games" folder so I could use it to practice with.Is that a bad idea?Could it be the problem?Also,in the tutorial the "pickPoint" is used inside of an "sceneWindow2D" function but in the TGB reference it is used as a callback on a "sceneGraph".Don't know if thats important or not.Anyway, i've tried several different things with no success.Any help would be appreciated.Thanx.

#1
01/02/2008 (12:19 am)
Oh well,I tried searching the forums for help with picking sceneobjects but if you only have the demo you can't access it.That sux a little.The only other coding i've tried was with "Game Maker" so you can imagine i'm a bit lost in TGB.Anyway Please help, my Demos running out and I would like to see if I can atleast learn some of the basics before I make a decision on purchasing TGB.Thanx for any help.
#2
01/02/2008 (6:46 am)
You should be able to do it in the demo version.

You should try the Torque Game Builder forums. If you click the Community Menu, then Forums, and then edit your subscriptions at the top, you should be able to add the public forums.
#3
01/02/2008 (10:34 am)
Try

SceneWindow2D.GetSceneGraph().GetPickPoint(0, 0)

The scene window is what levels are loaded into, the scene graph is the level itself. You start with the scene window, ask for the scene graph loaded into it, then get the list of objects at a particular point.

Hope it helps.
#4
01/02/2008 (12:05 pm)
Thanx David...I didn't know about the other forums.I really should post my questions there instead.Thanx also Nick...I'll give that a try right now...