Game Development Community

Brush Based Triggers?

by Nicolai Dutka · in Torque Game Engine · 09/30/2007 (4:03 pm) · 2 replies

I need triggers that are not square (or rectangle :P ).

I can overlap triggers and setup a trigger counter system, but this has limitations. The overlapping triggers have to do the same thing or else it can get ugly.

Basically, here is what I am trying to do:

I need to be able to track what type of terrain the player is standing in ( grass, mountain, swamp, snow, etc ). Unless there is a way to check the name of the texture at the player's position, this has to be done in triggers. As you can imagine, my world is NOT square, so square triggers are a HUGE pain in the butt.

I was really hoping to have brush based triggers so I could sculpt the trigger to match my terrain, but I am told Torque can't do that. So, now I need to figure out a good way to zone out my entire world map so I can tell what type of terrain you are standing in. (This is an RPG and this info is needed to launch the correct battle maps. I don't need players fighting in mountainous arenas when they are in the desert...)

I have an air travel system set up with triggers in the sky positioned perfectly over the "landable" terrain. A lot of these overlap since they are square and the world is not. This is ok, because all of the landing zone triggers do the same thing. All I do is count how many you are standing in. If it's 1 or more, you can land, if it's 0, you cannot. This is cool, but doesn't work for terrain type tracking.

Wherever the terrain changes, say from grass to beach, there has to be a trigger in both the grass and the beach area. They CANNOT overlap or else you would be in both the beach and the grass at the same time and then i can't load the proper battle map. So, the triggers have to be PERFECTLY lined up with each other so you are ALWAYS in a trigger (unless you are traveling by air or boat), but also so that you are NEVER in more than one trigger.

This is mostly a huge pain because the damn triggers are all square! I cannot properly cover my terrain with triggers because I cannot possibly get them all to line up with each other, line up with the terrain textures, AND not overlap...

So, what would be a good way to do this?

#1
09/30/2007 (5:05 pm)
Kingdutka,
couple things -

to link several triggers so that they act as one, you might find the recent SimSpace Trigger Aggregator resource useful.

however,
i believe there is a much better way to determine what type of terrain the player is on - a raycast straight down can return the material the player is over.

check out the use of "rInfo.material" in in Player::updateActionThread(),
#2
09/30/2007 (5:10 pm)
Oooh! I like the way that sounds! (The raycast straight down thing) Unfortunately, I don't know what to do with that or how to set it up...

If anyone knows how this would be done, let me know! (I will mess with it as much as I can on my own and post my findings here)