doors and other ents
by Desmond Fletcher · in Torque Game Engine · 11/02/2001 (12:03 pm) · 8 replies
Anyone know how to make the door entity work?
I created a trigger ent (with trigger texture) named t1. Then i created a door named d1 with the trigger01 argument as t1. I also added a pathstart (p1) and pathend (p2) pointing to each other. And, the door spec for pathname pointing to p1, the pathstart.
Results: this sequence is in the map, map2dif didn't choke on it, but the door is not visible.
ALSO: does anyone have a listing of what's broken or what's not?????
I created a trigger ent (with trigger texture) named t1. Then i created a door named d1 with the trigger01 argument as t1. I also added a pathstart (p1) and pathend (p2) pointing to each other. And, the door spec for pathname pointing to p1, the pathstart.
Results: this sequence is in the map, map2dif didn't choke on it, but the door is not visible.
ALSO: does anyone have a listing of what's broken or what's not?????
#2
I'm quite curious in regard to this too.
Is the code in torque to handle doors and entity based triggers? At least triggers?
01/31/2002 (3:56 pm)
Just bumping this up, maybe someone found a solution now...I'm quite curious in regard to this too.
Is the code in torque to handle doors and entity based triggers? At least triggers?
#3
Wont be long.
Phil.
01/31/2002 (4:07 pm)
I'm working on fixing this right now. Doors and moving platforms. Neither work as is.. notice how all T2 buildings have large open holes you have to jetpack through?? Wont be long.
Phil.
#4
My curiosity stems from wanting to possibly create things like rotating brushes or falling boulders or the like with brushes. Should I be thinking of doing this with shapes and script?
01/31/2002 (5:17 pm)
Phil, I know you've been hit up for too many tutorials lately, so I'm not asking for one :) But maybe you could give us the overview of what you're looking at. What code is there and what isn't or what is functional? Are the doors shapebase objects, etc? I would appreciate it if you just have a moment to give us your views.My curiosity stems from wanting to possibly create things like rotating brushes or falling boulders or the like with brushes. Should I be thinking of doing this with shapes and script?
#5
The doors, triggers, and markers are all exported by the map2dif program so you don't need to recompile that. What you need to work on is importing it during run time.
Here's my code (in interiorInstance.cc) that got triggers working, I essentially just edited the code that was commented out there for doors. The problem with the doors is that there's no class for them or there was but wasn't completed. Essentially if you could chop that subobject off as a seperate interior (I managed to do that but then can't add it to the mission hierarchy) and get in ingame you'd be set.
I simply named my trigger TestTrigger and when I ingame I tried isObject(TestTrigger) and I tried echoing its transform and got good results both times.
Now if I could only add the sub object as a separate interior I could handle the rest just fine. Like I said most of the code is there.
02/01/2002 (5:19 am)
OK I tried some things and I was succesful at importing triggers into my map.The doors, triggers, and markers are all exported by the map2dif program so you don't need to recompile that. What you need to work on is importing it during run time.
Here's my code (in interiorInstance.cc) that got triggers working, I essentially just edited the code that was commented out there for doors. The problem with the doors is that there's no class for them or there was but wasn't completed. Essentially if you could chop that subobject off as a seperate interior (I managed to do that but then can't add it to the mission hierarchy) and get in ingame you'd be set.
void InteriorInstance::addChildren()
{
if (bool(mInteriorRes) == false)
return;
char nameBuffer[256];
U32 i;
// First thing to do, add a group with our name
SimGroup* myGroup = new SimGroup;
dSprintf(nameBuffer, 255, "%s_sg", getName());
if (!myGroup->registerObject()) {
Con::warnf(ConsoleLogEntry::General, "Warning, could not register interior subgroup. MagicButton aborted!");
return;
}
getGroup()->addObject(myGroup, nameBuffer);
// create triggers
for (i = 0; i < mInteriorRes->getNumTriggers(); i++) {
InteriorResTrigger* pITrigger = mInteriorRes->getTrigger(i);
// Add the object...
Trigger* pTrigger = new Trigger;
pTrigger->setField("dataBlock", "defaultTrigger");
if (!pTrigger->registerObject()) {
Con::warnf(ConsoleLogEntry::General, "Warning, could not register trigger. Trigger skipped!");
delete pTrigger;
continue;
}
myGroup->addObject(pTrigger, pITrigger->mName);
MatrixF newXForm;
createTriggerTransform(pITrigger, &newXForm);
pTrigger->setTriggerPolyhedron(pITrigger->mPolyhedron);
pTrigger->setScale(mObjScale);
pTrigger->setTransform(newXForm);
}
}I simply named my trigger TestTrigger and when I ingame I tried isObject(TestTrigger) and I tried echoing its transform and got good results both times.
Now if I could only add the sub object as a separate interior I could handle the rest just fine. Like I said most of the code is there.
#6
The door resource saving code was already in there, but I didnt like the way it was working, so i'm trying something a tad different (I'm saving some strings so that I can do a lookup in game, rather than (seemingly) trying to save paths at save-time).
The next step, after the interiors are saving correctly (which they pretty much seem to be now) is to get the entities re-created in the engine, thats what I'm working on now.
I'm using the code for forceFields and MirrorSubObjects as a basis for reading in the data I need and parsing it into a viable interior instance, once thats done, its just a matter of getting the critter to render correctly.
After that, Ive got to add the lookup code for the path (Ive modified paths to include spline based paths as well as just point interpolated ones), that's then used to smoothly interpolate the position of the movingInterior over time (so for instance with a closed loop spline you could have a platform moving round a level as a platform you can jump onto.
Anyway, I'm about halfway through it i think. The main bulk of the code is already in the engine, just need to work out the parts to connect and connect em :))
As for falling rocks, I'd do em as shapes, they'd be far easier.
Phil.
02/01/2002 (11:04 am)
Ok, my current work so far has been to get the entity parsed (thats already in) and to actually save out enough information to make the movingInterior (door, moving brush basically) be able to do its stuff in the engine.The door resource saving code was already in there, but I didnt like the way it was working, so i'm trying something a tad different (I'm saving some strings so that I can do a lookup in game, rather than (seemingly) trying to save paths at save-time).
The next step, after the interiors are saving correctly (which they pretty much seem to be now) is to get the entities re-created in the engine, thats what I'm working on now.
I'm using the code for forceFields and MirrorSubObjects as a basis for reading in the data I need and parsing it into a viable interior instance, once thats done, its just a matter of getting the critter to render correctly.
After that, Ive got to add the lookup code for the path (Ive modified paths to include spline based paths as well as just point interpolated ones), that's then used to smoothly interpolate the position of the movingInterior over time (so for instance with a closed loop spline you could have a platform moving round a level as a platform you can jump onto.
Anyway, I'm about halfway through it i think. The main bulk of the code is already in the engine, just need to work out the parts to connect and connect em :))
As for falling rocks, I'd do em as shapes, they'd be far easier.
Phil.
#7
I'm not sure of what the mirror object is though.
I was going about it your same way but I couldn't get the bsp leaf attached to a simobject, I just don't know the algorithm well enough. Once that's done it's a cinch to add to the mission.
02/01/2002 (11:15 am)
The forcefields actually do look like the grab bsp leafs for their shapes even though I'd thought it would simply replace them (like a trigger does).I'm not sure of what the mirror object is though.
I was going about it your same way but I couldn't get the bsp leaf attached to a simobject, I just don't know the algorithm well enough. Once that's done it's a cinch to add to the mission.
#8
any further ideas?
02/03/2002 (2:43 am)
I have managed to separate the shape into its own Interior object but it needs to be an interior resource to be added to the mission simgroup...any further ideas?
Torque Owner Stefan