Problem Sphere-Mesh Collision

Apr 10, 2008 at 8:48 PM
Edited Apr 10, 2008 at 8:50 PM
I am trying to make a game like Marble Blast.
I am constructing the pipe from parts that are exported to seperate meshes.
If the sphere crosses the bounds of two meshes too fast this sends the sphere flying (or jumping if gravity set higher). Even for the same straight pipepart.

This is an example i extracted from my source.
Use WASD to navigate the sphere.
Most times press w until sphere takes flight.
Change Scene1() in LoadContent() to Scene2,3 to see different approaches.
Scene2 uses one mesh that was combined from 2 parts with merged vertices.
Scene3 uses the mesh from scene two without middle vertices.
Scene4 can be ignored.

Check comments of CreateViewMatrix() to use a free flying camera. Use mouse and arrow keys for movement.

I tried to modify the Material properties,Gravity Mass, PhysicsSystem.Integrate(50 iterations per frame with 0.001 and other values).

I tried the stable and the latest version of JigLibX.
Apr 11, 2008 at 12:49 PM
Hi, a user has posted this problem before. He was using primitives (boxes) instead of triangleMeshs, but his sphere also bounced around.

I had a look into the source code and i found that if you change

Vector3 collisionN = (dist > float.Epsilon) ? triPointSTNorm : triangle.Normal; (line 91 in SphereStaticMesh.cs)


Vector3 collisionN = triangle.Normal;

it works. But I have to look deeper into it to understand whats going on there. Maybe DeanoC will have a look at it. He loves the TriangleMeshs ;)

Btw. thank you for some sample code. Many user say "there is problem a when i do b".... thats hard to debug. Good luck with your project!
Apr 11, 2008 at 4:27 PM
thanks that works fine for me.
Apr 30, 2008 at 11:49 AM
noone88: Sorry for the delay in replying... I will have a look at why thats in SphereStaticMesh.cs, I think that line is trying to improve the contact normals to reduce jitter and reduce discontinous motion across sharp edges.. but I think it has the side effect reported which means its doesn't work very well...

I need to examine the geometrical effects of it, so I think applying your fix across the board is the 'right' answer at the moment. It might increase jitter slightly but will be more stable to use the triangle normal as you said..