"One side collider" ?

Hi,

Is it possible to create a collider with a trigger that will be started only when the player goes through by one side (the other side of the collider doesn’t launch the event).

Not directly, but there are several ways to simulate this behaviour. It depends on what exactly you need.

For a case like this I used overlapping colliders and a counter.

Another approach is to stick three colliders next to each other, with the left activating the middle one on enter, the middle one activating whatever you want to activate, and the right one de-activating the middle one on enter.

That gives you the behaviour that someone going through the 3 colliders left-to-right will activate whatever you want activated, while someone passing through right-to-left will find the middle trigger deactivated, and it only gets activated again if he leaves through (or comes by another path from) the left.

There are other ways, for example by using only one trigger and checking the movement vector of the object that enters.

1 Like

Thank you.

I’m working on a racing game and I want to make sure the player doesn’t drive in the inverse direction to cheat.

Oh, then you should just activate the colliders in order and make sure span the width of the area in which player should trigger the checkpoint.

Ok :slight_smile: Finally it was my first idea. I didn’t know if there are some special colliders for this.

Thanks

Nope, just give each car a next checkpoint if they hit a checkpoint which is not the next then you shouldn’t count it.

Yeah, if you want to make sure that they take the checkpoints in order, that’s the way to do it.

If you also need to ensure they are driving through the checkpoint in the proper direction, a vector comparison would probably be the easiest if you know your vector math.