Slecting objects in playgui
by Jake london · in Torque 3D Professional · 07/16/2009 (4:50 am) · 13 replies
For the last 4 days ive searched everywhere for a method to select objects in the world space. I need the player to be able to select or click an object in the game, using the mouse. which will in turn exec a command.
i found this tutorial but it seems outdate for toque 3d (2002).
http://www.garagegames.com/community/resources/view/7335
any ideas? Thanks
i found this tutorial but it seems outdate for toque 3d (2002).
http://www.garagegames.com/community/resources/view/7335
any ideas? Thanks
About the author
#2
most of the files it talks about i am unable to find. for example:
Make sure and delete the current config.cs and config.cs.dso files found in /starter.fps/client -- cant be found anywhere
engine/game/gameTSCtrl.h - doesnt exist.
all these have either been changed or removed. I am still new to torque. and it been two weeks since i got my hands on it. so youll have to excuse me if missing whats right in front of me.
07/16/2009 (6:33 am)
thanks for your replymost of the files it talks about i am unable to find. for example:
Make sure and delete the current config.cs and config.cs.dso files found in /starter.fps/client -- cant be found anywhere
engine/game/gameTSCtrl.h - doesnt exist.
all these have either been changed or removed. I am still new to torque. and it been two weeks since i got my hands on it. so youll have to excuse me if missing whats right in front of me.
#3
config.cs used to account for key bindings if I'm right, you would need to look for scripts/client/default.bind.cs.
As for gameTSCtrl.h, its still there, try gui/3d/guiTSControl.h.
It is likely that you will bump into more "missing" files - though only a few are really missing (most likely moved).
You should speak to GG about getting TGEA and TGE source access for your account (being a Torque3D licensee, you are eligible afaik), which will make porting old code a lot easier for you. Then, you can just check the TGE / TGEA file the resource mentions, and look for similar code in the Torque3D source.
07/16/2009 (6:50 am)
Hey Justin,config.cs used to account for key bindings if I'm right, you would need to look for scripts/client/default.bind.cs.
As for gameTSCtrl.h, its still there, try gui/3d/guiTSControl.h.
It is likely that you will bump into more "missing" files - though only a few are really missing (most likely moved).
You should speak to GG about getting TGEA and TGE source access for your account (being a Torque3D licensee, you are eligible afaik), which will make porting old code a lot easier for you. Then, you can just check the TGE / TGEA file the resource mentions, and look for similar code in the Torque3D source.
#4
Again
Thanks for the help
07/16/2009 (6:55 am)
hey thanks Konrad, i was using torsion IDE and couldnt find those files decided to try open it in VS and found them all, I'm going to try and edit them now and see what happens. Again
Thanks for the help
#6
07/16/2009 (9:23 am)
Just to note that it is present.Quote:Just the GuiShapeNameHud isn't present in Torque3D...Look again.
#7
07/16/2009 (10:10 am)
I think if you own T3D you can just purchase TGE and TGEA at no cost. Seen that floating around in some thread somewhere. Might be quicker than asking.
#8
Anyways, it isn't used like it was in TGE and TGEA, so it doesn't interfere with the object selection resource. At least, it isn't used in a new project build, don't know in genre kits.
07/16/2009 (2:46 pm)
Thank you Michael, yes it is still in the source code.Anyways, it isn't used like it was in TGE and TGEA, so it doesn't interfere with the object selection resource. At least, it isn't used in a new project build, don't know in genre kits.
#9
Object selection is handled by processing 3d mouse events that get passed to EditTSCtrl callbacks (in code). It is a "3d" mouse event because EditTSCtrl handles generating a 3D point and 3D vector representing the cursors location. With that data you can do a raycast or what-have-you and see what you hit.
IMO this makes sense to keep in code rather than script. So you might, for example, make your PlayGui a new class derived from EditTSCtrl.
07/17/2009 (10:43 am)
I haven't looked at the resource that was linked too, maybe its great, but imo this is already a solved problem - just take a peak at how the WorldEditor works. Object selection is handled by processing 3d mouse events that get passed to EditTSCtrl callbacks (in code). It is a "3d" mouse event because EditTSCtrl handles generating a 3D point and 3D vector representing the cursors location. With that data you can do a raycast or what-have-you and see what you hit.
IMO this makes sense to keep in code rather than script. So you might, for example, make your PlayGui a new class derived from EditTSCtrl.
#10
07/17/2009 (10:48 am)
I take back what I said. The PlayGui is a GameTSCtrl so it would be more appropriate to add functionality to it (as the resource is) than to start using EditTSCtrl as your PlayGui. I do still reccomend looking at the worldEditor to see how it works and other things that could apply, like representing a selected object by rendering its bounding box.
#11
http://www.garagegames.com/community/resource/view/10359/4
Step 5, is to add code to the shapeBase.cc file,but none of the code before and after where you must place matches, and thus i cant compile my project without including that part.
Thanks for all your help
07/18/2009 (10:47 am)
Thanks, ive tried going trough the tutorial but got stuck at very last bit, http://www.garagegames.com/community/resource/view/10359/4
Step 5, is to add code to the shapeBase.cc file,but none of the code before and after where you must place matches, and thus i cant compile my project without including that part.
Thanks for all your help
#12
Thank You.
07/28/2009 (6:44 pm)
How do you add sound or music to the gui menu? it has the option but unable to insert it in.Thank You.
#13
There is a tutitorial about attacking in the docs that does the raycast seems like it wouldn't be too hard to adapt it to a selection.
12/25/2009 (10:15 pm)
The config file is generated when you use the options dialogue to change controls so it's not there all the time.There is a tutitorial about attacking in the docs that does the raycast seems like it wouldn't be too hard to adapt it to a selection.
Torque Owner Davide Archetti
Default Studio Name
If you follow that resource and understand what you are doing, you shouldn't have problems.