so basically, for some reason, unity collision is inverted. when i mark one object as trigger, they dont collide but when i mark both as not trigger, they collide (i tested it with print(collided); line of code in oncollisionenter2d. so whats the problem? one of them has a rb2d, other doesnt. both have box collider2d, and rigidbody is dynamic.
a trigger never collides, it triggers. of course both need to be not trigger
Colliders marked as a trigger no longer collide with other objects. A trigger is only meant to detect when other objects pass through the space occupied by its collider. If this is the behavior you want, use OnTriggerEnter2D instead of OnCollisionEnter2d. If you want both objects to collide and interact with each other, don’t mark either as a trigger.
Inherently, when you tick the Is Trigger boolean on a Collider, it is going to ignore collision with other colliders. That is the whole point of triggers. I think you’re confusing a Collider feature with a Collision feature. OnCollisionEnter2D does not take a collider as parameter, it takes a collision. That is, it detects when two colliders contact each other. When you set one of the colliders as a trigger, it no longer contacts the other collider, hence there will be no callback from OnCollisionEnter2D function. In case you’re trying to trigger an event, you need to use OnTriggerEnter2D. If you can give a more detailed explanation of what it is exactly that you’re trying to achieve, I might be able to help you further.