Page 1 of 1

Player bounce when walking on flat surface

Posted: Sun Oct 16, 2011 12:30 am
by GameOn
Hi

I have a terrain created as a btBvhTriangleMeshShape.

The physic looks perfect except for one extremely annoying problem : when moving on a flat surface from this btBvhTriangleMeshShape terrain, the player (a capsule shape) "bounce" in the air from about 0.01 meters every time it crosses a 2 traingles's boundary even though the surface is perfectly plane.

I tried adding low to gigantic amount of margin with absolutely 0 impact on the problem.

...do if anyone have any idea on what could cause the problem ?


feel free to ask for more precision if I'm too vague.
I can even post the application itself if it can help you guys see the problem.

... I am a little bit deseperate.

Re: Player bounce when walking on flat surface

Posted: Sun Oct 16, 2011 12:33 am
by GameOn
well looks like somebody is having the exact same issue as I do 5 topics lower.

what are the odds :shock: ?

Sorry for that post then, il follow your link zarlox
zarlox wrote:This is due to the contact response on internal edges. The solution has been posted many time. Check this thread and implement the solution exactly as Argez showed. This should fix your cylinder jumpiness.

http://bulletphysics.org/Bullet/phpBB3/ ... dge#p24566
...and il dig to find out how to solve what I now know is called "internal edge collision"

Re: Player bounce when walking on flat surface

Posted: Mon Oct 17, 2011 9:57 am
by MaxDZ8
Maybe I'm a bit pedantic but I'd also consider the chance to get the rid of the triangle mesh and try simple collision shapes.

Re: Player bounce when walking on flat surface

Posted: Mon Oct 17, 2011 2:21 pm
by zarlox
MaxDZ8 wrote:Maybe I'm a bit pedantic but I'd also consider the chance to get the rid of the triangle mesh and try simple collision shapes.
Well, as long as you want a flat terrain, you can swap your triangle mesh with a plane shape. this will fix the internal edge collision.

But if you want to shape your terrain with hills and such, then you can't really use simple shapes and a btBvhTriangleMeshShape is the most appropriate you can use

Re: Player bounce when walking on flat surface

Posted: Mon Oct 17, 2011 6:07 pm
by MaxDZ8
Perhaps for terrains with overhangs. That's fairly advanced... but hey, everyone has a different need.
I'd take a look at TerrainShape as well. Currently, I'd love to see some hard data about its perf.

Re: Player bounce when walking on flat surface

Posted: Mon Oct 17, 2011 9:29 pm
by zarlox
Of course, you always should use with better fit your needs :)

In my project, i first used the btHeightfieldTerrainShape. It is quite easy to setup from a height array and is fast.

However i had those internal edge contact normal issues and to fix them using the current btInternalEdgeUtility, the utility (more precisely the btGenerateInternalEdgeInfo() function) only takes a btBvhTriangleMeshShape object. So i could not fix the contact issues using the terrain shape. For sure its doable but not out of the box :P

The other reason i had to switch from the terrain shape to the triangle mesh was that i needed to match my rendered terrain which is the Ogre3D 1.7 terrain. Ogre3D use a triangle strip so even and odd triangle rows are oriented a different way and the terrain shape do not give you the option to do this afaik.

Performance wise however, i did not see a difference between both collision shape but i never really properly benchmarked.

Re: Player bounce when walking on flat surface

Posted: Tue Oct 18, 2011 6:25 am
by MaxDZ8
zarlox wrote:Ogre3D use a triangle strip so even and odd triangle rows are oriented a different way and the terrain shape do not give you the option to do this afaik.
That's bad news.
I don't really mind for the orientation - I don't see any problem in swizzling the input data, but I totally need control on how the internal tris are generated (as in Unreal). I will have to look at that carefully.