BoxCollider2D: The collider did not create any collision shapes as they all failed verification.

So I am busy with a 2D top down shooter and have added a follow script to my enemies. I have noticed that whenever they rotate to face right the collider just dies and starts up again if they rotate left.

Is there any way to fix this? I have tried making the colliders bigger but its not helping.

Vertex spacing of any polygon needs to be greater than 0.0025 (2.5mm) then the collider cannot create the shape. In the case of a Box, it’s a polygon with a single shape so any problem with it gives you the warning in the thread title. For PolygonCollider2D, it’s possible that some or all can be like this so you get an appropriate warning.

It doesn’t ‘die’, you are creating a box that is too small for Box2D to handle. Remember that these are 2D colliders so rotating doesn’t rotate into 3D space i.e. in Z so when you rotate, you are simply transforming the vertices in 2D space. By the sound of it, you are rotating it so that the box (at some point) is just a single line of zero width or height during the animation. This is no longer a valid box that can be created by Box2D hence the warning we provide in the inspector.

The collider is simply warning you of the situation so you can choose to ignore it if it’s only for a fraction of time during an animation.

3 Likes

Its a top down shooter. When my enemy turns and faces right and only when that happens the collider gives the error and no longer works. If I turn the enemy to face left it comes back on. The reason why I dont think it makes sense is because if it doesnt work facing the one direction then it shouldnt work when facing the other direction. Can I send you the project so you can have a look and see what I mean?

Probably best if you can create a bug report with a simple project attached. Failing that, yes, just give me a link to download it.

1 Like

HI, im getting this issue.

I am spawning a new gameobject with a spriterederer. It is NOT rotated or scaled. I can’t click on the sprite. If i disable it and re-enable it, it works and the warning is removed.

Te collider size id: 1.2x0.9

The only thing i can think of is the gameobject is being spawning in a 3d space.

running into this issue with auto generated spriterenderer sprites from layers in the 2019.1 PSDImporter …

Never seen a bug report despite asking. Saying you’ve got the same problem won’t solve it either. If you can reproduce the issue then please submit a bug report.

1 Like

I ended up just using BoxColliders which seem to work fine with SpriteRenderer. This works out great since I needed to raycast hit in 3D these 2D things.

I have a similar issue, but as far as I know I followed the tutorial (Jared Halpern’s Developing 2D games with Unity) and he never mentioned this possible problem, he just said to create the BoxCollider. When I expand it to .0025, the player gets pushed up to the map, possibly because of background objects, and cannot go downwards at all.

Image attached:

4824638--462827--boxcollider issues 8-2019.jpg

Because your box is obviously too small and Box2D (the underlying physics engine) cannot create such small objects (0.1mm). As I said above, Vertex spacing of any polygon needs to be greater than 0.0025 (2.5mm).

1 Like

Here is a video to document what happens when I set it to .0025. I am not sure if I made the colliders wrong on the background objects or if there is an issue with the collider on the player (using Prefab for the object). Would I have to upload the Unity document to get a precise answer?

This is off-topic for this thread. Above is the reason why you get the warning which is telling you no shapes could be created. You should start a new thread for your issue.