Advanced C++/Graphics Tutorial 49: Capsule Collision

preview_player
Показать описание
Today we learn a new collision shape, the capsule!

Рекомендации по теме
Комментарии
Автор

If anyone is having a hard time getting their character to *JUMP* on angled surfaces (those of us that type along rather than copy code anyhow). Can fix the problem by changing the following line in the *Player.cpp update()* code...

change the following line from this...
*if(manifold.points[i].y < body->GetPosition().y - m_capsule.getDimensions().y / 2.0f + 0.01f) {*

to this...
*if (manifold.points[i].y < body->GetPosition().y - m_capsule.getDimensions().y / 2.0f + m_capsule.getDimensions().x / 2.0f + 0.01f) {*

That fixed it for me.

NeilRoy
Автор

Excellent tutorial. I was wondering before about projecting for nearest collisions with a frame-adaptive ellipse(wasn't using box2d), although now that I think about it, a capsule is probably more secure and the bottom curve is less sharp which makes it move a bit more smoothly. Nice thing about this is you can switch the static friction to make ice or solid.

AlienScribble
Автор

I've been working on my own little project thats similar to this, having your tutorials as reference when I get stuck. Now I'm really stuck, I try to use one circle only as collision box and I fall correctly and dont go through the ground but Im not able to add velocity, it seems as Box2D thinks Im not touching anything though it still knows where the ground body is.
Any suggestions? I know it may be hard without the context, but much appreciative of any advice.

Aikko
Автор

Hey Ben! Do you also have some trouble with jumping now? When the player is on a slight slope he won't jump anymore!

jaap
Автор

Hey Ben, do you know the game TIS-100? You _will_ love it

DJoppiesaus
Автор

Hey, I think the github is not synced or something. Can't find capsule or am I blind? Thanks for the tut!

Andrewpowah
Автор

Hi Ben, can you please make something about simple 2d lighting ?)

iliasviatlovich
Автор

19:29 shouldn't top circle be m_fixtures[2]?

noneegy
Автор

WooHoo.

I have no questions this time, I just want it to be clear that I'm ready for the next episode :D . 

hint hint, nudge nudge know what I mean... (Read in a Michael Palin voice.)

Would you kindly make 30 more episodes this week (Read in the voice of Andre Ryan.)

PS: If you don't get the references I'll just assure you I'm not trying to be rude.

jim_o
Автор

what's the video with normal collisions? I'm struggling with it now and in this video you copy a bunch of older code so I can't learn collisions from it :(

Popexssj
Автор

Hey Ben i'm having major issues getting a grasp on things with C++, i'm not following your tutorials letter for letter, but kind of making my engine my own way as I go through your tutorials, unfortunately i'm having troubles with some ideas like type comparison, as well as using an Abstract Base Class as a parameter. Is it possible you can maybe help me on Skype, or something else you would rather prefer to help me get a better grasp on things? These issues are preventing me from moving on, I do have a lot of experience but only in Java and C#. You can imagine why I would be having these issues coming from those languages. I would greatly appreciate your assistance.

karutoh