Unity 2d Box Collider Not Working

I have tryed to figure this out but I found nothing, I have 2 sprites same x cordinate and when the y and z meet They Pass through each other. I have the 2D box colliders checked off. Thanks For Reading This! Hope U Know How To Help :slight_smile:

Please Don’t Start Each Word From The Capital Letter - it’s difficult to read :slight_smile:

As for the problem, try to add RigidBody2D. I have colliding objects, both have Box Colliders 2D with ā€œIs Triggerā€ turned on and Rigid Bodies 2D with ā€œGravity Scaleā€ == 0 (so as not to let them fall).

Thanks for helping me with that Caps Thing (i edited it and fixed it). Sorry I am 10 and new to Unity so I’m still learning :).

I tried that and it isn’t working. My project can be found here(Link: Dropbox - Error - Simplify your life), could you look at it and tell me why the collision detection isn’t working? WASD to move (if needed TFGH for creeper move)

1 Like

For starters you are using Vector2 so there is no Z-axis anyway.

I am assuming you are using the latest version of unity at this point in time and are using the 2D system so set the game up for 2D by using an orthographic camera and click the ā€˜2D’ button in the scene tab.

You dont need to put ; at the end of the closing } in ā€˜creeper following algorithm.js’

You dont need any transform.position.z really as you are not using them.

This should never be true if you want to detect the collision as the colliders should stop this happening:

if (cx == sx  cy == sy)
 {
transform.Translate(Vector2(1, 0) * Time.deltaTime * speed);
}

There are some other things so I made a package of the changes I made.
Make sure the main camera is set to:

position x0 y0 z-10
projection orthographic
size 12
clipping planes near 0.3 far20

1448515–78174–$first_project.unitypackage (142 KB)