How to set a function to the upside part of the collider ?
i have an object with a collider, I want to the top part do some function, and the down part do other.
how should i do that?
How to set a function to the upside part of the collider ?
i have an object with a collider, I want to the top part do some function, and the down part do other.
how should i do that?
you can use two gameObjects with separate boxCollider , and add two different scripts on that like …
void OnCollisionEnter2D(Collision2D colisor) ///// in first script
{
if (colisor.gameObject.name.Equals(“Player”) // && downpart)
{
damage.Attack();
}
}
void OnCollisionEnter2D(Collision2D colisor) /////// in second script
{
if (colisor.gameObject.name.Equals(“Player”) // && downpart)
{
damage.Attack();
}
}