
I'm having a problem with Bepu 1. I've modified the CharacterController to use a Capsule instead of a Cylinder to improve movement over bumpy surfaces. It was quite straightforward (actually replacing Cylinder with Capsule is 99% of the job) and works really well... except for a very weird case.
When the modified CharacterController hits a box which is rotated 90º in Z axis the collisions fail, the capsule penetrates the box and you can even climb the box. However it only happens with 1 of the faces of the box! Pushing from all other faces works as it should.
I've uploaded a private video to show the problem:
https://www.youtube.com/watch?v=r0tUChIThNA
The first and second box I push in the video are rotated 90º in Z. Second box is scaled ~1.5. Only the most visible face fails, I can push the other faces all I want that there won't be any bug. Third box has no rotation in Z whatsoever. Shows no problems with any face.
I've found that other rotations can also fail, but it's very easy to make it fail with Z=90º. I've also found that the higher the scale of the box the lower the penetration amount is. However you can still climb slowly the box. In very rare cases I haven't been able to determine, the bug encompasses 2 faces of the box, but in most cases the number of faces affected is only one.
All of this doesn't happen with the standard character controller.
There's only one real difference between the Cylinder and Capsule CCs, which is Margin.
I've found out that if you specify a margin to the Capsule, the effective radius of the Capsule is set to the margin value. For this reason I've
commented the line which sets the margin.
I've been playing with different values of margin for the capsule and all of them seem to give the same problem, except values very close to 0.
In any case I'm completely lost with this issue, but I'd really like to stay with the Capsule CC as it works a lot better than the Cylinder one.
Any ideas on what I could try to fix this?
Thanks!
EDIT: Just a note: A simple Capsule entity not attached to the modified CC does not have any of the problems described either. So the problem is probably localized in the CC code.