Capsule collider is not working properly (4:45 in video)


when I add a capsule collider to my character (Benson McGee), it adds it like this, no matter what position my character is in, and whether or not I have the things (idk what they’re called) set to pivot and local or center and global. I’ve looked though all of the threads on this lecture and idk what I’m doing wrong. I’m in Unity 2021.3.4f1 btw. It’s probably something simple, but it’s been bugging me for about a day now.

Hi,

That’s indeed odd. Is “Benson McGee” or his parent rotated? Did you rotate the children (= the game objects with the sprites)? It is often difficult to interpret what one sees because everything moves relative to other things in Unity.

Have you already tried to restart Unity? What happens if you remove the CapsuleCollider2D component and readd it?

If nothing helped, maybe there is a bug in your version of Unity. Have you already tried to update?

Hello,

It is the parent game object “Benson McGee” that is rotated, because if I rotate the children like what was done in the video, the top and bottom won’t properly line up anymore.
image

I’ve closed and reopened Unity multiple times and nothing changed. Same with removing and readding the CapsuleCollider2D component, which I am adding onto the parent “Benson McGee” as is done in the video.

I have not tried to update Unity, so it is possible it’s just a bug in my version.

It is not a bug in Unity.

The capsule collider tries to match the shape of the renderer it is attached to. In your case, there is no renderer because you didn’t attach the collider to the same game object as the sprites. So, you have to manually adjust the collider until it matches what you need.

image

You have to adjust these values. The easiest may be to click this button and adjust it in the scene

image


Also

image

You can move these child game objects around to line up once they have been rotated.

Okay so I completely deleted the character and started from the beginning of the video. I had to make sure the cinemachine camera was looking at the new character, so I did that. I then followed the EXACT steps shown in the video, taking into account the positioning, things in the inspector, etc. It seems to have worked, and my collider is working fine now.

I think my problem was that I wasn’t setting the parent object to be in the actual middle of both of the child objects. I also took into account the repositioning the top after I rotated the character, and that worked.


I made the collider smaller than the snowboard to give a more realistic feel with the collision.

Thanks for the help!!

Oh my goodness, now I’m having a problem where everything in my game view is super pixelated. Idk what I did, because it wasn’t doing this earlier when I was having the collider problem. Also, I know my game view scale is 4.6x, that’s just to show the problem easier. Idk how to fix this, even after googling it. It’s not a super big deal, but it is a tad annoying.


Good job on solving the problem with the capsule collider. :slight_smile:

That’s because of the Scale value. Set the scale to <= 1 to see how the actual game will look. What you see in the game window is what the camera renders. The camera renders an image, which has got the size of “Free Aspect” (= your game window). If you scale the game window up, you basically zoom into that rendered image.

ah okay, thank you!

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

Privacy & Terms