3
\$\begingroup\$

I'm working on a ragdoll fighting game as a hobby project, but I have one dilemma. I am not sure if my ragdoll should collide with itself or not, i.e. if ragdoll's body parts should collide.

2D world is somewhat different than 3D, because there are several layers of stuff implied (for example in Super Mario you jump through a platform above you while going up).

The setup I'm currently most satisfied with is when only the parts which are joined by a joint don't collide, so head doesn't collide with neck, neck with chest, chest with upper arm etc, but the head can collide with chest, arms, legs.

I've tried every different way, but I'm not content with either. Which way would recommend me to go?

\$\endgroup\$

3 Answers 3

2
\$\begingroup\$

It depends on the style of game and the "perspective" you're going for, really. For the sake of argument I'm assuming your game is a pure side view instead of top down or faked perspective (think castle crashers or final fight).

Generally I would think you wouldn't want anything to collide. In a pure 2d game you aren't really going to be able to pull off what you might need self collision for anyway, like the body landing on it's side, or legs getting twisted up. Now you could do that with a 3G game played in 2d, but I'm guessing that's not the point.

\$\endgroup\$
1
\$\begingroup\$

I'm not an expert when it comes to ragdolls but when I think "2D fighting game" I imagine seeing the fighters from the side.

So colliding legs won't work or the poor guys/gals won't even be able to walk. Also the arms shouldn't collide with the torso (because of the side-view). The limbs should collide with the head though, so that if a player has raised his arms in defense and gets hit, the arms will hit the head.

It probably helps to think in layers. The arms are on another layer than the legs or the torso and therefore don't collide. You wouldn't want the arms to be affected by a kick.

I'd probably setup the collision group as follows:

  • Head collides with everything.
  • Arms collide with head.
  • Legs collide with torso and head

It's probably best to reduce the amount of possible collisions within a ragdoll to a minimum and just work with joint constraints. And of course playerA collides with playerB.

\$\endgroup\$
0
\$\begingroup\$

Again - the perspective, PoV, matters. But I imagine a fighting game just like Tekken or Street Fighter.

In that case - there probably should be some layers, from front to the back.

Front layer would (for example) have right arm of the fighting figure, as well as the whole right leg. Assuming he is facing an opponent to the right of him on the screen. Middle layer would be head and torso, and finally the layer furthest from the camera would contain the rest.

The layers would not collide with each other - otherwise the figure would not be able to walk.


But this makes me think - there is no point for collision detection at this point. Player would most likely be in a standard boxing pose, which means that the wrist should not collide with the shoulder - it would be hard to make an arm bend otherwise.

This can be fixed by splitting both the wrist and the shoulder into two sub-parts, which would not collide at the elbow joint. It would also enable stuff like breaking arms possible, but this is quite a lot of work.

For the legs - the same, because they wouldn't bend normally otherwise.


The final answer IMO is no, but IF you want to invest some more time into stuff like fractures and realism, yes.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .