When play collide with object, i want to player work differently.
If player collide with upside, then player’s speed get up.
But palyer coliide with downside, player’s speed get down!
If you know function that can get object’s colliding side(up, down, left, right),
please help me!!
I use C# language.
In OnCollisionEnter, the Collision parameter includes Contacts, a list of points of contacts and information about what was colliding. From there you can deduce where the contact occurred.
If that is too complicated to use (and sometimes it’s just not that simple), you could simply put different colliders on the two sides which gives you two different scripts, one for the upside, one of the downside, which makes this quite obvious and simple.