animated characters body parts going through walls

Community Forums/General Help/animated characters body parts going through walls

RemiD(Posted 2016) [#1]
Hello,

I have noticed that in most 3d games, depending on the animation of the character and depending on the environment, some body parts of the animated character will go through walls or objects.

This is not really a problem and players probably don't care about that if the gameplay is fun enough and the controls are good enough however is there a way to prevent this ?

A possible way would be to have colliders (ellipsoids or boxes or low tris shapes) attached to each joint/bone of each character (which have approximately the same shape than the character), and if the character/weapon collides walls/objects while animating, either reoriente reposition the character (so that it does not go through the wall/object) or change the animation (i have seen this in some games when trying to attack with a weapon and if the weapon hits the wall, an animation of a collision with the wall is played (instead of continuing to attack with the weapon))...

However i don't think this is really usable if the game has narrow corridors, it can become really annoying to not be able to turnmove easily or to not be able to attack.

So the best approach is probably to not care about this ?

Your thoughts about this ?


grable(Posted 2016) [#2]
Usually this is done because its a pain to fix and it could slow down collision detection depending on the complexity of the model.

I dont care much about this to be honest, because anything you can do to mitigate it will make it at best irritating for the player and at worst cause him to get stuck or die.

Stopping the animation seems the best option, though it may look weird.
Other than that using 100% procedural animations could probably handle this, but then performance may suffer again.

For example. Im playing Just Cause 3 at the moment, and if the character is too close to a wall and his gun is touching it or very close to it. He just refuses to fire.
This even happens if im pointing away from the wall. Obviously the collision mesh is too large for the model, causing false positives here.
The end result is that i should be able to fire my gun at the baddies, but the game stops me and i die ;)

So if you need to do this, make it ONLY a visual thing. Never mess with the character or disallow player behavior because of it.

EDIT: This of course changes if its a Melee game, where hitting a wall with your sword should create some kind of response. Most games ive played do something here, though a lot of them can be a bit annoying as they tend to use too large collision boxes causing the sword to hit when you wouldnt think it could (im looking at you WindWaker!)


RemiD(Posted 2016) [#3]
Yes it is probably too complicated to create/manage a system to prevent animated characters to go through walls/objects, and it will probably disturb gameplay in narrow corridors/passages.
Since it is only for a game, it does not need to be 100% realistic, only convincing enough.

unreal engine approach : ( easy approach :P ) https://docs.unrealengine.com/latest/INT/Engine/Animation/RootMotion/index.html

I have seen a system to prevent animated characters to go through walls/objects in BloodRayne 2, and this was really well done imo... (But probably complicated to manage)


Cocopino(Posted 2016) [#4]
If it's really bad and/or bothering you at the moment, first thing I would look at is making it less of a problem the easiest possible way: make the collision capsule/sphere of your character a little bigger.
1 minute of work, no performance hit ;)


RemiD(Posted 2016) [#5]

make the collision capsule/sphere of your character a little bigger.


@cocopino>>of course, but if there are narrow corridors/passages in the environments, this solution is not possible.


One thing that i try to remind regularly is to not focus on unimportant details until the game is functional enough and nice enough, so i will forget about this issue for now !


Cocopino(Posted 2016) [#6]

One thing that i try to remind regularly is to not focus on unimportant details until the game is functional enough


Excellent advice!


Guy Fawkes(Posted 2016) [#7]
It's a Z-Depth issue.

~GF


RemiD(Posted 2016) [#8]
In a way yes, in a way no, it is, before being a z-order issue, a collisions detection and reoriente/reposition issue. Depending on the animation of the character and depending on the environment it can be difficult to not have some body parts go through walls/obstacles...


Guy Fawkes(Posted 2016) [#9]
Or you could attach a capsule or a quad to the vertices that hit the wall and give it sliding collision so that the capsule & / or the quad hits the wall instead then detects that & performs a "backwards" animation so that the character slowly retracts back to "idle" animation mode.

~GF


MadJack(Posted 2016) [#10]
narrow corridors/passages in the environments

Corridors in games are often quote 'roomy' compared to real life, to help with clipping/collision issues.


RemiD(Posted 2016) [#11]
@Madjack>>Yes i have noticed that.


Guy Fawkes(Posted 2016) [#12]
I still say attaching a sliding small capsule & / or quad to the vertices in which you do not wish to go through the wall will work great.

~GF


RemiD(Posted 2016) [#13]
@GF>>The idea sounds cool, the implementation is not easy because it can make the turns moves (the gameplay) difficult.
For example, what would you do if different body parts intersect with different walls/obstacles at the same time ? it can quickly become a mess to manage.


Guy Fawkes(Posted 2016) [#14]
Well then what's an easier way of doing it? I think this should be in the Code Archives for everyone's use. I'd love to see a demo of this. If you think you have a better idea, well then. Lets see it.

~GF


RemiD(Posted 2016) [#15]
My current approach is to not care about unimportant details, you can notice this problem (some body parts of an animated character which sometimes go through walls/obstacles) in many games.
And even if it is possible to solve this problem, the solution will create another problem : prevent the player to turn move act as he wants in the environment (especially in narrow corridors/passages).


Guy Fawkes(Posted 2016) [#16]
I beg to differ. This is a VERY important part. If I'm going to play a game, it is to ENJOY it. NOT to play in glitch land.

~GF


RemiD(Posted 2016) [#17]
I have noticed this problem in many games... Look at modern game engines like Unity3d or UnrealEngine, they use capsule colliders (for characters) to detect collisions with the walls/obstacles, and consequently, depending on the animation of the character, some body parts will go through walls/obstacles...


Guy Fawkes(Posted 2016) [#18]
not if you give each of the invisible capsules / quads a radius.

~GF


Blitzplotter(Posted 2016) [#19]
Would making corridor walls thicker help....


Matty(Posted 2016) [#20]
Play in space - no walls - no problem ;-)