Why does my RigidBody sphere "jump" on a flat surface?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By madmenyo

I imported a model and made sure all vertices are aligned vertically to create a perfect flat surface. From this model/mesh I create a static body. The sphere, which is a RigidBody with a sphere as it’s CollisionShape rests on this surface. When I call ApplyImpulse from the RigidBody Origin the ball moves but it is bouncing/hopping/jumping over the surface as if it was not flat.

Upon creating a planar mesh with a planar static body the ball did smoothly role over the surface so it probably has to do something with my mesh. Like I said, the surface I’m talking about is completely aligned in height. No smoothing group is being applied on the surface the ball is rolling. This is what the mesh looks like:

enter image description here

Are you creating a convex collision shape or a triangulated one? In your image the collision shape is not visible, this shape is what the collision systems uses, you may needto change this shape to have a smooth movement.

davidoc | 2019-01-14 19:45

@davidoc I used the import hint -col on the mesh node in the model. The hierarchy is mesh>StaticBody>CollisionShape where the CollisionShape holds the mesh again.

madmenyo | 2019-01-14 20:41

Ok, I changed -col to -convcol and the ball interacts properly with the mesh now. But obviously the ball is hovering over the green area since I now have a convex collision shape. The only solution to make a curve like in my image would be to cut up the floor in multiple meshes and create conv pieces out of the floor, perhaps put 3 or 4 quads per mesh. But since the walls need the smoothing groups, I have to deal with the less accurate concave collision for them and I already noticed some strange bounce behavior from the walls in my previous tests.

madmenyo | 2019-01-14 21:07

I have not used import hints, but you could try -colonly with another meshes only intended for collision, and leave your original mesh with the smooth groups. You’ll need to experiment what fits your needs better.

davidoc | 2019-01-15 02:01

I did this and it works a lot better now. Even the walls, being a concave collision mesh do a good job. However, splitting the floor up in parts does pop the ball up when it goes across this edge. I made sure these edges are aligned within the engine and model itself. Is there some setting to reduce this effect on the rigid or static body?

madmenyo | 2019-01-15 19:51

There are issues with the physics system, when you mentioned it I tested my game and there are some pushing when moving over the connection of two rigid bodies. It may be a bug, I suggest you to create a simple project and post it on github.

davidoc | 2019-01-15 21:42