0
\$\begingroup\$

so my code on my collider is as followed

public class Collide : MonoBehaviour
{

    private void OnCollisionEnter2D(Collision2D collision)
    {
        Debug.Log("Collision");
    }
}

the projectile has a rigidbody2D and a capsule Collider 2D.

collider has a box collider 2D.

the projectile spawns from my player and moves upwards in the direction of the collider (the collider is large enough that the projectile cant miss it).

the projectile however goes straight through the collider and no message appears and I have no idea why.

what I've tried and made sure of :

  • both are on the same layer and plane(z axis)
  • gave the collider a rigidbody but changed nothing
  • made the collider on trigger and not on trigger
  • made the projectile dynamic and kinematic
  • changed collider script to onCollisionEnter and onCollisionEnter2D
\$\endgroup\$
2
  • 2
    \$\begingroup\$ Hi ! Have you checked in your collision matrix in Physics if both game objects layers can collide ? \$\endgroup\$ Jan 7, 2019 at 13:15
  • \$\begingroup\$ What framework are you using? If that is java, I would reccomend switching to python cause there isba larger game development communkty over there \$\endgroup\$ Jun 7, 2019 at 17:56

1 Answer 1

1
\$\begingroup\$

As stated nu Sebastien Servouze I reallised after some searching arround that there is indeed a collision array matrix, which solved my issue.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ If the issue is solved, make sure to mark your answer as correct, so others don't have to spend time answering. \$\endgroup\$ Feb 8, 2019 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .