TriggerObjectTypes
by Anthony Rosenbaum · in Torque Game Engine · 06/30/2003 (8:04 pm) · 18 replies
I am current enhanching the mapGui to render trigger areas too, my current problem is that I can't seem to find them. I am using this code
For some reason I never can find anything with TriggerObjectType in this set, Am I missing something, are triggers not added to this set?
Any IDEA?
for (SimSetIterator itr(conn); *itr; ++itr) {
if ((*itr)->getType() & GameBaseObjectType) {
GameBase* shape = static_cast<GameBase*>(*itr);
if (shape->getType() & TriggerObjectType ) {For some reason I never can find anything with TriggerObjectType in this set, Am I missing something, are triggers not added to this set?
Any IDEA?
About the author
#2
07/02/2003 (3:59 pm)
Go to the trigger class, and have it call addToScene?
#3
Is there a class I need to be included for this function to work?
07/02/2003 (6:49 pm)
Ben when I do that I get this error E:\After School Cartoons\Lore\loreengine\engine\game\trigger.cc(107) : error C2065: 'addToScene' : undeclared identifier Error executing cl.exe.
Is there a class I need to be included for this function to work?
#4
07/02/2003 (7:23 pm)
You need to call addToScene in the object.
#5
07/03/2003 (5:21 am)
Nope tried that too, so vertict is addToScene() is not adding it to the SimSetIterator
#6
First off if I try to compile the GUI part with the isServerObject I get an error saying it is undeclared identifyer, then if I add netObject.h to the includes I get newline in constant error
Lab Rat just informed me that triggers are not ghosted, so does that mean I can't acess them at allfor the client. I was able to get the code working for the server just not clients.
07/05/2003 (12:46 pm)
SO here is another approach in the trigger I do this if (isServerObject())
{
Sim::getServerTargetSet()->addObject(this);
}
else
{
Sim::getClientTargetSet()->addObject(this);
} then in my GUI I do thisSimSetIterator itr(Sim::getServerTargetSet());
if(!isServerObject())
itr = SimSetIterator(Sim::getClientTargetSet());
for (; *itr; ++itr) {
if ((*itr)->getType() & TriggerObjectType) {First off if I try to compile the GUI part with the isServerObject I get an error saying it is undeclared identifyer, then if I add netObject.h to the includes I get newline in constant error
Lab Rat just informed me that triggers are not ghosted, so does that mean I can't acess them at allfor the client. I was able to get the code working for the server just not clients.
#7
trigger get stopped from being ghoste like this
So some questions, does PackUpdate() get called only if an object is set as ghostable, if so how should I optimize it? or is this lag a result of the additional rendering of the trigger boxes?
07/05/2003 (2:09 pm)
Ok found some more interesting stufftrigger get stopped from being ghoste like this
mNetFlags.clear(Ghostable);and gets toggled on and off when you open up the editor. So once I set it to always be ghostable this code worked but then it renders the box of the trigger. Finally this little snippet of code in the packUpdate
Quote:Doesn't look so good, and after testing it one dosn't seem optimized at all, becaused is resulted in a lot of lag.
// Note that we don't really care about efficiency here, since this is an
// edit-only ghost...
So some questions, does PackUpdate() get called only if an object is set as ghostable, if so how should I optimize it? or is this lag a result of the additional rendering of the trigger boxes?
#8
07/06/2003 (9:59 am)
OK well I was able to make the triggers Ghosted, now I just want a cetain trigger. My inital attempt was thisif(dStrcmp(shape->getDataBlock()->getName(),"TeamTrigger") == 0)It worked well for the server, but when a client joins it caused a crash. Anyone have an Idea?
#9
07/06/2003 (10:29 am)
Have you tried debugging it?!?!
#10
Why don't you just transmit the location of the trigger to the client via a remote script call, if you only want one? Or use a NetEvent (see netTest.cc for details).
07/06/2003 (11:06 am)
The datablocks aren't loaded at the same time as the shapes, so you need to be careful about accessing members in them.Why don't you just transmit the location of the trigger to the client via a remote script call, if you only want one? Or use a NetEvent (see netTest.cc for details).
#11
@Ben : I have made it ghost only what is needed so there is no overhead.
I still can't find the dataBlock's name. Are the names accesable to the client? My main concern is that the AITurrets use triggers for player detection. I have also tried culling out triggers with an owner (turrets) set but neither seem to work.
Any Ideas?
07/06/2003 (11:43 am)
@J. Donovan : debugger saysdodwords: [b]->[/b]007FC760 mov eax,dword ptr [edx]I can only read the debugger when it is in the C++ code , the assemble stuff still beyond me.
@Ben : I have made it ghost only what is needed so there is no overhead.
I still can't find the dataBlock's name. Are the names accesable to the client? My main concern is that the AITurrets use triggers for player detection. I have also tried culling out triggers with an owner (turrets) set but neither seem to work.
Any Ideas?
#12
As for the datablock - like I said, it's PROBABLY not loaded yet. The server transfers datablock info the client, but it takes a while for it to get across, make sure that getDatablock is even returning a valid pointer!!!
07/06/2003 (1:04 pm)
I think there is overhead; development overhead ;). The two ways I suggested would be much faster and simpler to implement if you only want a one-shot tansferral of the trigger data.As for the datablock - like I said, it's PROBABLY not loaded yet. The server transfers datablock info the client, but it takes a while for it to get across, make sure that getDatablock is even returning a valid pointer!!!
#13
I know that shape is ok, but when you say "is valid" what do you mean?
I did
But still crashes the client.
07/06/2003 (2:24 pm)
I know what you are thinking, about development overhead, code for the trigegr's boxes, rending the polygons, I got that all toggled via a flag ;) it just send it's location.I know that shape is ok, but when you say "is valid" what do you mean?
I did
GameBase* data = shape->getDataBlock(); if(data != NULL)
But still crashes the client.
#14
Since the GameBase's datablocks are... of type GameBaseData.
07/06/2003 (4:39 pm)
You meant:GameBaseData* data = ...
Since the GameBase's datablocks are... of type GameBaseData.
#15
07/06/2003 (4:56 pm)
Yeah I actually am using that, but is my if statment the correct test for validity?
#16
07/06/2003 (10:04 pm)
Yeah, it should be.
#17
07/07/2003 (2:38 am)
Anthony, If shape->getDataBlock() is blowing up then you don't have a valid shape pointer. You really might want to reconsider your approach.
#18
notice how the line Any Ideas? was at the end of each post. That means I have run out of them ;)
07/07/2003 (5:38 am)
Any recommendations?notice how the line Any Ideas? was at the end of each post. That means I have run out of them ;)
Associate Anthony Rosenbaum