[SOLVED] Smooth rolling ball

I’ve got a ball rolling along a flat surface. However, sometimes it will suddenly “bounce” as if it has hit an invisible wall, or slightly change direction. I assume this is because a sphere isn’t truly spherical. Is there a way around this? My ball has a radius of 1 and I’ve got 32 samples and radial samples to make it as spherical as possible, but still the problem occurs.

Thanks in advance!

What is your floor like? Large triangles?

It’s just a simple Box() geometry.

I’ve just created this video to demonstrate the problem. In the vid, I’m applying a pretty constant force most of the time, but sometimes it seems it’s not even enough force to move forwards.

Physics engines are one of the few places in the universe where spheres actually ARE round.

…so then you have to look at the surface they are rolling on. Or in your case, how you are applying the force.

…because while one giant huge single polygon surface can cause issues for a physics engine’s collision detection, your issue looks like you are applying strange forces as the object rotates. So I’d check the force code first and make sure your applied vectors are consistent with expectations.

Edit: and that you are using the sensible method to do so.

However only if he’s using a SphereCollisionShape and not a Mesh Accurate Shape (which is the default constructor for RigidBodyControl). That’s the first thing I would check

1 Like

Oh… hahah. Good point.

Edit: actually, as it turns out RigidBodyControl is smart in that case if the object actually is a JME Sphere.

But it’s still true if he exported a sphere from Blender or something crazy like that.

1 Like

This is why I read every thread.

I never made the connection that shapes in jme are not the same thing as a model created with 3d software.

Something so obvious now that you mentioned it.

1 Like

I’ve just worked out the problem: I was adding the sphere geometry to an (empty) parent Node, and using that Node to for adding the RigidBodyControl control, and adding it to the physics space.

1 Like

Also something possibly worth mentioning: if you apply a torque onto the sphere to make it spin instead of a movement force it may roll more naturally. It may need more friction in that case however.