Game Development Community

Of triggers, object bitmasks, and radius search

by Demolishun · in Torque Game Engine · 04/06/2004 (11:07 pm) · 2 replies

Hello,
I have begun messing with triggers. Right now I have a trigger that will detect objects then do radius searches on each mountpoint on the object. I intend to use this to notify players that they can mount a vehicle at a certain location by pressing a button. Or inform them that a weapon is available on the ground. No, I don't like Quake style autopickup. I am attempting to do it Halo style.

Here are my questions:
Can the trigger mask be set from script? If not I will add the functionality to alter this behavior by script.

Is there an object bitmask available in the scripting? Right now I have to set some variables to the equivalent bit value. For playerobjects this is: 16384 (bit(14)) and for vehicles 65536 (bit(16)). Is there a power function in script?

Is this approach going to cause a huge performance hit? Right now I have two objects: a tank and a player. The trigger I am using is huge. It occupies the entire mission area. I intend on controlling the egress from the mission area using physical barriers of some sort. This is the reason I need to control the bitmask for the trigger. It may be fast enough to ignore the extra hits, maybe not.

Thanks,
Frank

About the author

I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67


#1
04/07/2004 (2:59 am)
If this is just for informing the players about things they can do, you could possibly try a gui like the shape name hud. Maybe even add to it allowing the control to display more information within a certain distance of each type mask. Just an idea.


Edit: Another way you could do it is with on collision in scripting, even though you wont be picking it up by running into it, you could pop a message up to the client. There are a couple more options, let me think on it.
#2
04/07/2004 (9:09 pm)
Bruce,
I plan on adding gui data to inform the player when they get close enough to a vehicle/weapon if there is a place to mount (for vehicles anyway). Is the shape name hud position sensitive? I am not familiar with hud stuff yet. Have not yet made it to that side of the engine.

I think the on collision could work for weapons, but I would rather the player be "close enough" for vehicles. If I do this right I should be able to mount things in mid air as well. Maybe not realistic, but way cool.

I do realize the huge trigger is kind of a hack, but after trying unsuccessfully to merge triggers with shapes in a derived class, and having to recompile each time, I got a little tired of hacking on the engine. So I am trying a different angle that I believe will work, then try a similar modification of the engine to get the same functionality.

What I tried to do on the engine was merge the trigger class with the GameBase class to get a mountable trigger. I ran into ambiguity messages on compile and threw up my hands and am trying something else. I will probably go back to that when I get better experience with inheritance in C++. I did look at creating a different call to mount triggers as is on a vehicle, but trying to duplicate what the engine did for gamebase objects it became clear that I would have to modify several classes to do so. Call it laziness, but I am now taking the path of least resistance to regain my confidence. :)

Thanks,
Frank