rapier
rapier copied to clipboard
Objects falling between heightfields
(Mentioned this on Discord, I'm filing a ticket so it doesn't get lost).
Because my game world is extremely large and chunks are dynamically loaded as you travel, the terrain is broken up into chunks of 16x16 meters, where each terrain chunk is represented by a heightfield. The edges of the height fields are flush with no gaps or tears.
One thing I have noticed is that my character's capsule collider tends to fall through the seams where two heightfields join.
What is interesting is that the fall isn't immediate - it's hard to say for sure what is happening, but it appears as thought the moment the character crosses the seam, the capsule is now slightly interpenetrating the heightfield - and further motion causes the character to slowly sink into the ground.
Note that this occurs even if the heightfields are completely flat.
If I change this to a triangle mesh - with the exact same vertices - the problem does not manifest. That being said, the triangle mesh is much more expensive and I would prefer to use heightfields if I can.
Note that even if this was a floating-point error or something, the diameter of the capsule is on the order of half a meter, so even if there was a gap they should not fall through.