Hey folks.
I am slowly (a bit here… a bit there) trying to get my head into the Unity way of doing things.
I think I need to make a major shift in my mindset in order to pull this off. Things that I find simple to do if I wasn’t using Unity seem overly complicated in Unity. It has always been this way to me. And I am sure it has to be because I am just not getting it.
Here is an example of something I expected to be super easy.
Say you are making a top down view game and there are two things in this game world:
A player cube you can move around.
A building made up of several cubes (done this way so there is an opening for a doorway to enter & exit the building).
- When the player gets near to the building you want the player know that.
- When the player enters the building you want the player to know that.
- When the player exits the building you want the player to know that.
- When the player moves away past the “near zone” of the building you want the player to know that.
I have it working as far as actually detecting Entering and Exiting in both cases (the “near zone” of the building as well as entering / exiting the building itself) and sending that info to the Player. That part was easy.
And this is how I approached it…
I put two colliders on the building and set both as Triggers:
- First a larger one that covers entire building extending past the building outside for a couple of player cubes worth of distance. This represents the “near zone” and is used to detect the player entering & exiting the near zone of the building.
- The second collider is inside the building and is used to detect the player entering and exiting the building.
The problem is in the script attached to the building I have no way of knowing which collider has fired. The only information the OnTrigger events receive is the otherCollider and there seems to be no way of knowing which collider on this side was involved in the collision.
Am I missing something?
Is there a way to find out which of the two trigger colliders has fired?
Or am I just approaching this completely the wrong way for Unity?
Like I said I am trying to wrap my head around how people actually use this thing. lol
Thanks!