Hi I am making a runner game where if you hit one of the platforms on the y side the player dies. Does anyone have any suggestions on how only sides of a box colider could affect the player in one way? Thank you if you can help!
In your collision code, include a check of the normal.y. If you know the normal in world space of the side that kills the player, this should work:
if(collider.GetContact(0).normal.y > 0.9f)
{
//kill player
}
That code above will check the normal of the face of the other object in the collision (not the one the script is attached to) and if the normal is pointing exactly upwards in world space, it will run the code inside. Depending on what sides you want to include, you can expand on this code to check all directions you wish. Cheers