Game Development Community

Triggers moving with Vehicles

by Demolishun · in Torque Game Engine · 04/01/2004 (9:42 pm) · 3 replies

Okay, I need a trigger to move with my vehicle. I have tried using the trigger "tick" function, but this only works if the player is in the trigger. Is there a similar "tick" function for the vehicle? What are the parameters for this function? Should I be doing the transformation on the trigger using the simgroup?

I want to use triggers to provide feedback to the player that you can mount at a specific location. Once you see the message on the HUD you will be able to press a button to mount. The triggers need to move so a person could mount the vehicle while it is moving. The goal is to get "Halo style" mounting and dismounting. I plan on deleting/disabling the trigger when the player mounts. That way another player can not mount at the same location. After a person dismounts then the trigger would be recreated/enabled. This should allow mounting of objects, such as turrets, that are attached to a vehicle themselves. Just create a trigger for the turret that is at the origin of the turret and only "knows" about the turret.

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/02/2004 (8:12 am)
Perhaps you should roll the functionality into the core vehicle code and have the vehicle manage the position of the trigger so that the trigger is always in synch?
#2
04/02/2004 (8:31 pm)
Ben,
Maybe I should be look into using the mount points to mount the trigger into. This way it will use code already developed for this purpose. It would not be the same as a player being mounted into the vehicle. It is related to the mount point anyway. If I need 360 degree coverage for that point I can just put 4 trigger boxes in the point. I will have to look into the trigger class to see if it can mount or if I need to inherit from another class to do so.

Another cool idea for mount points is ladders on vehicles. It could allow someone to "grab" onto the vehicle and climb up the ladder. Then get into another "official" mount point higher up. This could be cool for large vehicles with seats higher up in the vehicle. The ladder mount point could allow movement in the Z axis of the vehicle.

Is there a way to cause friction of the vehicle surfaces to the player? So one could walk on it while it is moving.

Thanks,
Frank
#3
04/03/2004 (7:50 pm)
Okay,
I have taken many twists and turns on this and think I have a solution.

I went into the dark recesses of .h and .cc files only to find the triggers are not ShapeBase! So Using standard mount/unmount routines would not work. So I looked into inheriting these qualities only to get frustrated by ambiguity issues of which I do not understand. So I began to rethink how this might be accomplished.

I found a cool script call: containerBoxEmpty. I then began to think about how to use this. I then came up with the idea that vehicles do not need to have a periodic tick to check for players to mount. I can just use one huge trigger set to periodically run mount checks on vehicles. This trigger would be so massive it would consume the entire level! It would have a mask to only check for vehicles (I think I can set a mask?). Once a vehicle is found a "containerBoxEmpty" call would be performed on each mountable node to determine if any players are close enough to mount that node.

In fact this could be extended to players to check for mountable weapons. That would eliminate the need for a mask. All of this, I believe, could be done script side as well.

I will start on this to see where it goes,
Frank