Game Development Community

Possible for a door to stay open?

by SqHd · in Torque Game Engine · 12/26/2007 (10:22 pm) · 3 replies

Hello,

I've recently added the door resource (from ch. 4 of Advanced 3DGPAi1) into TGE. It's great to have doors! I noticed that they swing closed on their own (after a set time).
Is there any way to have the door stay open until a key is pressed to close it?

Thanks.

#1
12/27/2007 (2:35 am)
Instead of using a timer - give the door object a varable called isOpen. (that is the object, not the datablock) and toggle this variable true/false every time the door is activated. ie. the first time the door is activated it is 'opened', the next time it is 'closed'. Use the same code that the timer calls to make the door close.

I can't be more specific as I don't have the book you're using - but the theory should be correct.
#2
12/27/2007 (7:19 pm)
Thanks for the advice. I've checked out some of the other door resources. A couple had the same auto close feature, but it looks like one might be promising. I'm going to try your suggestion in the next day or so. I'm an artist so it'll be intereting. :)
#3
01/04/2008 (9:43 pm)
You could also give $DOORS::HOLD_TIMER (at the top) a really high number and that should keep the door open for a long time.