Scale circle colliders relative to sprite size

Hi all,

How did Rick scale the colliders relative to the sprite size?

If I select multiple sprites of different sizes, add a Circle Collider 2D, and change the radius of multiple sprites simultaneously they all become the same size. When Rick did it in this lecture the Circle Collider 2Ds scaled with the sprite size. How?

Thanks!
Kong

Rick


Kong


Hi Kong,

Welcome to our community! :slight_smile:

You have to select sprites that are equally large because the radius values refers to World Units (relative to the scale of the game object), not to the size of the sprite. As you can see, there is a “—” in some of your screenshots. This indicates that the colliders have got different values in the radius field.

Did this answer your question?


See also:

Hi Nina, thanks for the response,

No - I’m still not sure how Rick managed to resize the collider radii differently for different sprites, all at once. If you watch closely he manages to resize proportionally to each sprite size. My whole question is a really minor point but I’m interested - is there some hotkey or setting/parameter to do this?

Best,
Kong

I’ve rewatched the part in the video (hopefully, the correct part). He does not type a hard-coded value. When you hover your mouse over the label or field and drag the mouse while keeping the mouse button pressed, you can proportionally scale the sprites.

It’s hard to see but an icon pops up when he does what I described above:

image

Hi Nina,

I was using the mouse slider for Radius as well - I think I figured it out.

The 2D collider will not scale with the sprite based on the original size after importing from assets. The 2D collider will scale with the sprite if the sprite is re-sized.

Here’s an example - hopefully the animated gif works.

First, I import two sprites with two different sizes. As soon as I change the collider radius by clicking and dragging the colliders snap to a uniform size.

Second, I import the same sprite and resize one. Now the collider scales relative to size.

Thanks,
Asa

gif

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms