Character stance transition problem: character goes through the ceiling

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Flanir
Posts: 1
Joined: Sun Mar 12, 2017 5:35 pm

Character stance transition problem: character goes through the ceiling

Post by Flanir »

Hi!

We have encountered the following problem.

If character controller's height more than 2f and he enters a room with 1f height in crouching mode and then toggle it off, controller will walk through the ceiling.

And second bug, if the controller's height is 1.5f and if you try jump then you will jump through ceiling.

See video:: https://www.youtube.com/watch?v=PsRMv2ihFV0

I've posted a project which reproduce the bug (see README.md for more information):
https://github.com/krasnotsvetov/BEPUPhysicsBug

Project contains two scenes: full scene and primitive scenes with less triangles.

Thank you!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Character stance transition problem: character goes through the ceiling

Post by Norbo »

Thanks for the report! And thanks for the repro too, that sped things up a lot.

Interestingly, this repro ended up revealing five bugs:
1) The side contact obstruction heuristic's design was poor, and its implementation was broken.
2) The unsupported resize case didn't properly handle head or side obstruction in some common paths.
3) The unsupported resize case didn't properly handle the offset search.
4) The supported resize case didn't properly handle the case that supporting contact could be an obstruction.
5) For robustness reasons, one sided meshes don't generate planar contacts with objects with a center of mass behind the triangle. When the character's standing height is more than twice the crouching height, it's possible for the center of mass to end up above the low ceiling, so it detects no contacts.

I think I might have been tired while writing this whole codepath :)

#1-#4 should be fixed now, but I'm still trying to figure out the proper level of hack to address #5. It looks like the lowest effort path is a hardcoded pair handler type check that forces mesh-based pair handlers to use double sided collision detection when querying for stance transitions. I might just do that in an effort to keep things working until I end up rewriting the character for v2's new architecture.

As a workaround until I have a fix for #5, you can try setting the mesh's Sidedness to DoubleSided. It's not a great solution, but at least it shouldn't meld through the ceiling.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Character stance transition problem: character goes through the ceiling

Post by Norbo »

#5 now 'fixed'. Let me know if anything's still messed up.
demiurghg
Posts: 14
Joined: Mon Jun 04, 2012 10:02 am

Re: Character stance transition problem: character goes through the ceiling

Post by demiurghg »

I've checked character behavior in our project with last revision of BEPUphysics.
Everything seems to be ok.
Thank you :)

P.S. We work with Flanir in a team.
Post Reply