Rolling ball jumps on flat surface

Sorry for the severely late response… I’ll take a look at what you’re talking about. Thanks for the input!

[=“bybw, post:28, topic:37461”]

To fix this issue for the landscape, you will have to apply the same contact offset to the landscape collision shapes in ULandscapeHeightfieldCollisionComponent::OnCreatePhysicsState.

eg. HeightFieldShapeSync->setContactOffset(MaxContactOffset);

[/]

I’m at the 4.21 fixed the meshes issue with the other engine change but the landscapes still giving the same issue, the solution you wrote don’t even exist.
Someone have a fix for the landscapes ?

Thank you.

1 Like

[=“, post:64, topic:37461”]

I’m at the 4.21 fixed the meshes issue with the other engine change but the landscapes still giving the same issue, the solution you wrote don’t even exist.
Someone have a fix for the landscapes ?

Thank you.
[/]

Got it fixed:

In the file LandscapeCollision.cpp:

extern ENGINE_API TAutoConsoleVariable<float> CVarMaxContactOffset;

then add the read of the var:

const float contactOffset = CVarMaxContactOffset.GetValueOnAnyThread();
HeightFieldShapeSync->setContactOffset( contactOffset );

Thats all!

Edit:
Now there is just a problem, the whole ball vibrates over the landscape surface :slight_smile:
The only way I found to fix it is hard fix the contactOffset value in the code to 0.05, for some reason isn’t reading it properly

Edit #2:

if you use const float contactOffset = UPhysicsSettings::Get()->MaxContactOffset; should be fine

Edit #3:

Made a pullrequestgithub.com/EpicGames/UnrealEngine/pull/7653

Do you need to do all three steps? I changed the value of the variable const float ContactOffset = ComputeContactOffset(Geom); + what is in the pull request and now there is vibration on both cubes and landscape

For the future landscape users with this issue…

After setting the ContactOffset to values suggested in this topic,

Click on the Landscape
Go to Collisions
Set “Collision Thickness” to a much lower value. 1 worked for me
Test physics

The ball should now roll perfectly smoothly. Tested on UE5 - however I did disable chaos solver earlier while trying to find a solution so this may or may not have an effect.

[=“THEAETIK, post:67, topic:37461”]
Click on the Landscape
Go to Collisions
Set “Collision Thickness” to a much lower value. 1 worked for me
Test physics
[/]

Yea dont.
Objects will be 10000% more likely to just fall throguh your landscapes. Thats pretty much all you are able to achive by reducing the thickness value.

Just as a follow up to the issues that I was having with this, I opened up my project from 4.21 to 5.1 and it just works. I didn’t change anything, so there you have it… I’m sure there were some of you out there losing sleep! LOL!

Thanks Epic!!

1 Like

In UE5.3 this issue reappeared. Changing offset settings has no effect. Anyone has any ideas how to fix this on 5.3 version?

this has been an issue for a long time, with multiple solutions that people are trying to get into engine, but it doesnt seem that things get fixed.
I will investigate earlier versions to see if same things happends, if they are there too I will actually have to learn myself another engine I suppose…

This issue reappeared in version 5.3, when I adjusted the ContactOffsetMultiplier, but it only improved, but the problem remained.

2 Likes

MinContactOffset, MaxContactOffset, ContactOffsetMultiplier aren’t used by Chaos physics at all! I’ve checked UE5.3 engine source code, they are remains of PhysX.

I think you may all be better off working the problem some other way - particularly with chaos.

For instance, one could make a spline mesh for the ball to roll on.
The different parts of the spline mesh should always be pefectly aligned collision wise, eliminating jumps or issues.

Another option would just be to test a few frames ahead of the ball to detect the landscape transition, then store the collision position you are reading, disable physics as soon as you are 1 frame away from the new landscape, move the ball to the other landscape manually using the stored positoon you tested collision for, and r-e acrivate the simulation while imparting the same speed from before the whole operation.

If the scope of the whole game is a sphere rolling around, then stuff like this on every mesh surface transition would ensure your travel did not get effected by something below a custom treshold you can eventually define / look up.

As always, with Physics you cannot rely on the engine to work, so you have to do at least some of the work for the engine…

pff the fix on physics x is pretty easy, but you would need to make your own engine as the pull request for fix is just overlooked.
And you cant really expect indie devs to go making their own stuff the first years.
nah, they should have fixed this in 4.27 first of all and then kept in 5…