Sphere physics. Infinite ball rolling

Maybe not a bug, but here goes.


As a disclaimer, I already looked at another similar posts and their solutions:

In Unreal Engine 4 if you add Sphere Simplified Collision to any mesh, and then apply a force to it on a horizontal plane — it behaves just like in the real world, except for the part where it should eventually slow down to a stop — actor never looses all it’s velocity. it still maintains a little “juice”, and keeps rolling on a flat surface to no end (friction, damping and etc. settings do not negate this effect to a stop).

My question is not about a solution to “how I can simulate my way around this effect”, but whether Epic recognizes this as something that is fixable in a near future?
Because until then, say goodbye to all your billiards, golfs, bowlings and what not.

Thank you!

The question is mainly about why such behaviour exists in the physics engine in the first place? Take Unity engine, for example, — haven’t had any problem with rolling balls, Box 2D — the same. I just want to understand is this normal or is it broken?

Besides, setting angular and linear damping only decreases the effect, and presents additional unnatural behaviour.

And setting manual thresholds to stop a ball when it’s still enough to stop also presents a problem — the need to discern whether the ball is on flat surface and coming to a stop, or it’s on a ramp and just reaches the point where it will go down.

I’m just a little baffled, that we can’t get “realistic” ball rolling behaviour “out of the box”. In our times of computing power :slight_smile:

jwatte, thanks for replying.

You need to add a rolling friction (damping) in addition to the linear friction.
Else the angular momentum will keep turning into linear velocity.
Also, setting the auto-disable thresholds high will help making sure it actually “stops” when it’s “still enough.”

Comparing to Box2D is a little bit of apples-versus-oranges. In real life, stopping something that is big and heavy and rolls is actually very hard. Even something that is small an light, like a soccer ball, will roll a long way before it stops – and that has a lot of deformation going on while rolling. Adding angular and linear damping is not “unrealistic,” it simulates energy loss that occurs when the surface of the ball deforms under gravity against the bottom. If you don’t want the ball to stop while on a slope, then detect the slope and modify the amount of damping (or sleep threshold) accordingly. If you tune the values of angular and linear damping appropriately to your intended object, and use a reasonable-but-nowhere-huge sleep threshold, you should be able to get a behavior that is what you want.

I’m not talking about a small inaccuracy in present ball physics (quoting your real life examples), I’m talking about an absolutely horrid effect we see. It is not something, that could be used as it is, that’s why the question. The physics in Unreal are great, BUT, excluding Sphere Simplified Collision.

And of course angular and linear damping would introduce unrealistic behaviour on higher settings, — the settings that do make a difference in this case.

I’m getting the feeling, you haven’t experienced what I’m telling about :slight_smile: If you could please create a plane and push a spherical actor on to it, you’ll see for yourself. I will certainly try my best in fixing this behaviour with “hacks”, but again, that wasn’t the question. It seems a bit impractical to write such substantial “what ifs” to already working physics simulation.

In an ideal world I’d wanted to hear from Epic on this question.

Thanks

Hi Romanpapush,

Jwatte is correct in how you would need to go about slowing the ball to a stop. These are templates that are setup to give you the building blocks to start your games from. Unreal Engine 4 is setup to give users the most flexibility by enabling the options they need rather than turning off the features that are on by default.

Thank you!

Actually, I don’t think this is solved – I set up a very simple test scene with two spheres, each had 0.1 linear and angular damping, and the spheres did not damp out the way I’d expect when compared to other physics engines. It looks like something is adding energy to the spheres as they are simulating.

RomanPapush – I agree with you. I set up a very simple test scene, and the damping does not work the way I’d expect it to. Or, more accurately, it seems as if the integrator somehow adds energy to the balls. Even a very slow-rolling ball with high damping factor will keep rolling forever.

Here’s a screen shot of the scene, and a screen shot of how I set up the sphere collider/actor. These actors will roll forever even when damping is set to 0.1. That’s a pretty clear indicator that the integrator adds energy, which I would consider a bug.

Thanks, Jwatte and RomanPapush, I’m starting to look into this now. I’ll get back to you on this.

jwatte, thanks for taking the time to test it out, and for initiative with the screenshots, I appreciate it. Now we wait :slight_smile:

Hello ,

Has there been any progress on the subject?

Thanks.

Hi Romanpapush,

I have spoken with some of the developers responsible for Physx and they are aware of the issue. They are discussing the best solution internally. However, there is no time-frame for this.

Thank you!

We have updated the game to 4.6 and still experience this bug. Our game completely resolves around a ball, so having this fixed has a high priority for us. Is there any update regarding this bug?

Yes, it’s time to fix this. Physics doesn’t make sense if it’s not robust. Adding energy to bodies during simulation step is not something anyone shipping a robust engine would accept; it’s like saying “we don’t support alpha in our renderer” or something.

There is no update at this time. Here is the JIRA # for reference though: UE-8793.

Hi all,
Thanks for your patience with this one. This behavior is currently expected in PhysX. Look under My spheres never come to rest : http://www.nvidia.com/object/physx_knowledge_base.html

However, we’ve started a thread with NVIDIA about this and we’re looking into a proper solution which is clearly needed for certain types of games.

I’ll keep you posted on this, but hoping to have a solution soon.

Thanks for the update. I disagree it’s the same problem, though.

The problem described in the article you link is “if you model a perfect sphere with no friction, it will roll forever.”

The problem we’re reporting is “even when adding friction, spheres roll forever – the integrator ADDS ENERGY.”

These two problems, on the surface, seem very similar, but the root cause is very different. If PhysX uses an integrator that adds energy to the system, there are many kinds of simulations that will never work right. (And this may explain some things about Kerbal Space Program, now that I think about it … :slight_smile:

I’m happy that you’re actually working with NVIDIA on this, and if you can put pressure on them to fix their stuff, that’s great! We just need the fix to be for the right problem, not the surface-similar wrong problem.

1 Like

problem still exists in 4.7/April 2015… billiard games are only possible with an unpretty workaround (if sphere slows down enough by damping… reduce velocity to zero)

so push, push and another push :slight_smile:
i know epic is very busy actually but it would be great to read a solution by official side

I’ve exposed a new project option which helps with the issue of the integrator adding energy. It’s basically a tradeoff between stacking stability and energy conservation so it’s up to the type of game you’re making.

https://github.com/EpicGames/UnrealEngine/commit/c8a733313af1aa39061afd92ea9ee3ca7662b790

This still doesn’t fix the problem where friction has little affect on the sphere. The problem here is that for a perfect sphere the contact patch is infinitely small. However, if you turn PCM on and use angular damping you should get reasonable results.

Hope this helps