I’m trying to check if my player collider hits another collider above it. Im not sure how the OnCollisionEnter function works or how to use collisionflags but is that what I would use?
I don’t know about OnCollisionEnter, but here’s a simple way of knowing if a player has entered a specific zone (I’m not sure if this is what you’re looking for):
Firstly, give your player the tag “Player” in the top left of the inspector tab.
On top of your player, there should be an empty gameObject that has a Box Collider, be sure to mark it as “Is Trigger” and add a javascript. In this example, the script is called “IsPlayerIn”.
Then, in the script write:
#pragma strict
function OnTriggerEnter (theCollider : Collider)
{
if (theCollider.tag == ("Player"))
{
Debug.Log("Player has entered");
}
}
When you play the game and jump (or enter the box collider) there should be a message on the console that reads “Player has entered”.
Hope this was helpful!