erratic kinematic character controller behavior

mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

erratic kinematic character controller behavior

Post by mickey »

Hi!

Foremost thanks for the update on the kinematic character controller - it now collides with dynamic objects totally wonderful.

Unfortunately I'm having some erratic behavior with the controller.

This screen shot is just one of them:

Image

See how the capsule shape is standing in the middle of the structure.

My step height is 0.15 if that helps. Character's width is at 0.3 and height at 1.0.

The character would jitter if it goes up the steps as well.

Also had to modify the m_addedMargin on btKinematicCharacterController to 0.1 so my character would slide (jitter happens as well, not smooth at all).

My scene is using bvhTriangleMeshShape and when my character starts to collide with the scene my FPS drops significantly (very noticeable, similar to the vehicle).

If playing with the values/properties of the btKinematicCharacterController would help please let me know. Perhaps the btKinematicCharacterController works best with the btConvexHullShape which the demo uses?

Thanks.
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: erratic kinematic character controller behavior

Post by pico »

Hi,

i think this problem is caused by
http://code.google.com/p/bullet/issues/detail?id=27 (Provide solution to filter out unwanted collisions with internal edges of a triangle mesh.)

Can you enable a wireframe rendering? There you could proof if you stand on a internal triangle edge.
User avatar
John McCutchan
Posts: 133
Joined: Wed Jul 27, 2005 1:05 pm
Location: Berkeley, CA

Re: erratic kinematic character controller behavior

Post by John McCutchan »

Hey Mickey,

Can you provide a small test triangle mesh and kinematic character demo that exhibits this behaviour?

Thanks,
John
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: erratic kinematic character controller behavior

Post by mickey »

Hi guys

Thanks for trying to help out. Okay I'll have the demo in a day or two.

Thanks in advance!
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: erratic kinematic character controller behavior

Post by mickey »

Hi John

Here you go:

http://www.programmingmind.com/sites/pr ... erDemo.zip

Just a few notes:

The only file you need to look at is btKinematicCharacterDemo.cpp, particularly the following 2 functions:

OneTimeSceneInit() - which initializes the kinematic character controller the same way as the bullet demo
UpdateClient() - character controller code. I added some code so rotation would be applied to the character by moving the mouse

There's also a release exe included in the zip file.

Also, if you would let me know of any tweaks you can do so that rigid bodies won't penetrate or get stuck on the static shapes that would be great, apparently the rigid bodies always gets stuck or passes through.

If things does not compile or run in your machine please let me know I would quickly fix it.

And last one, I have included all the necessary header files and run time libraries into the zip file, and have set the paths. The only path you need to include is the path to source bullet, otherwise the bullet libs (2.73 rc3) are also included.

Many thanks in advance!
User avatar
John McCutchan
Posts: 133
Joined: Wed Jul 27, 2005 1:05 pm
Location: Berkeley, CA

Re: erratic kinematic character controller behavior

Post by John McCutchan »

Hi,

Thanks for the demo. Would it be possible for you to hook up the ColladaConverter and save your scene to a file and attach it here?

Thanks,
John
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: erratic kinematic character controller behavior

Post by mickey »

Hi John,

Would you try this one? I used Blender to export the scene into Collada format (1.4).

http://www.programmingmind.com/sites/pr ... /scene.dae

Let me know if you need anything else.
User avatar
John McCutchan
Posts: 133
Joined: Wed Jul 27, 2005 1:05 pm
Location: Berkeley, CA

Re: erratic kinematic character controller behavior

Post by John McCutchan »

Hi,

I took a look at your collada file in the character controller demo. It does appear likely that the internal triangle edge issue is causing the problems. This is a known issue (http://code.google.com/p/bullet/issues/detail?id=27) In the meantime, you might consider breaking up your collision geometry into convex chunks.

Thanks,
John
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: erratic kinematic character controller behavior

Post by mickey »

Hi John

Thanks for trying to help.

Though that doesn't sound too pretty and maybe a little hard.

My scene is created in a 3D editor and I just load my entire static scene into a btBvhTriangleMeshShape.

Does that mean I need to manually create my scene by hand?

I don't think I can just load my entire scene and use a btConvexTriangleMeshShape?
User avatar
John McCutchan
Posts: 133
Joined: Wed Jul 27, 2005 1:05 pm
Location: Berkeley, CA

Re: erratic kinematic character controller behavior

Post by John McCutchan »

Mickey,

I think you should consider separating your rendering geometry from your collision geometry. Most games use simplified collision shapes and not their rendering meshes (aside from being less prone to bugs, convex chunks are faster)

HTH,
John
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: erratic kinematic character controller behavior

Post by Erwin Coumans »

[edit]

I doubt this issue is due to an internal triangle edge issue.

1) the kinematic character controller should work fine with concave triangle meshes (btBvhTriangleMeshShape)

2) this means convex decomposition or mesh simplification should not be required. Many games do actually use rendering meshes for collision detection, and that should work just fine, as long as you check for degeneracies and parts of the mesh that contain too much detail (a small 5000-triangle checker board can best be replaced by a box shape).

3) as long as you use a rounded shape, such as a capsule, the character shouldn't suffer from a 'interior' edge problem

I think we need to make improvements to the kinematic character controller. We should look into fixing this for Bullet 2.74 release.

Thanks,
Erwin
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: erratic kinematic character controller behavior

Post by mickey »

I just like to be clear with the problem. The collision between btBvhTriangleMeshShape and the kinematic character controller is perfect.

The problem is with the stepHeight or at least I can see the capsule / character sticking on the walls (ie, my screen shot)

I also tried scaling the whole scene, didn't help. Tried to expand the height and width + increase/descrease stepHeight, didn't help either.

Thanks I hope you guys can get this fixed soon! I would just love to load my entire static scene into a btBvhTriangleMeshShape and not worry about collision.