# Rolling ball jumps on flat surface

**URL:** <https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461>\
**Category:** World Creation\
**Tags:** unreal-engine, Physics\
**Created:** [August 3, 2015, 2:56pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461 "2015-08-03T14:56:14Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![xraygunner](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xraygunner](https://forums.unrealengine.com/u/xraygunner)\
**Post date:** [September 15, 2020, 2:47pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/63 "2020-09-15T14:47:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hevedy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hevedy](https://forums.unrealengine.com/u/Hevedy)\
**Post date:** [January 4, 2021, 2:16pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/64 "2021-01-04T14:16:02Z")

</div>

[=“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.

---

<div class="post-metadata">

**Author:** ![Hevedy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hevedy](https://forums.unrealengine.com/u/Hevedy)\
**Post date:** [January 4, 2021, 5:52pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/65 "2021-01-04T17:52:19Z")

</div>

[=“, 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 🙂  
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](http://pullrequestgithub.com/EpicGames/UnrealEngine/pull/7653)

---

<div class="post-metadata">

**Author:** ![FFREUTOFF](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FFREUTOFF](https://forums.unrealengine.com/u/FFREUTOFF)\
**Post date:** [January 21, 2022, 11:03pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/66 "2022-01-21T23:03:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![THEAETIK](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/theaetik/32/1183323_2.png) [@THEAETIK](https://forums.unrealengine.com/u/THEAETIK)\
**Post date:** [January 11, 2023, 9:12pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/67 "2023-01-11T21:12:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [January 12, 2023, 2:47am UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/68 "2023-01-12T02:47:02Z")

</div>

[=“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.

---

<div class="post-metadata">

**Author:** ![xraygunner](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xraygunner](https://forums.unrealengine.com/u/xraygunner)\
**Post date:** [April 10, 2023, 11:21pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/69 "2023-04-10T23:21:25Z")

</div>

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!!

---

<div class="post-metadata">

**Author:** ![Elitic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Elitic](https://forums.unrealengine.com/u/Elitic)\
**Post date:** [September 15, 2023, 6:38pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/70 "2023-09-15T18:38:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Thunderpwn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Thunderpwn](https://forums.unrealengine.com/u/Thunderpwn)\
**Post date:** [September 16, 2023, 7:32am UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/71 "2023-09-16T07:32:55Z")

</div>

> [@THEAETIK](#):
>
> chaos solver earlier while trying to find a solution so this may or may not have an effect.

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…

---

<div class="post-metadata">

**Author:** ![Elvisa0023](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Elvisa0023](https://forums.unrealengine.com/u/Elvisa0023)\
**Post date:** [October 7, 2023, 3:43am UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/72 "2023-10-07T03:43:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Elitic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Elitic](https://forums.unrealengine.com/u/Elitic)\
**Post date:** [February 6, 2024, 12:19am UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/73 "2024-02-06T00:19:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [February 6, 2024, 5:50am UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/74 "2024-02-06T05:50:18Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Thunderpwn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Thunderpwn](https://forums.unrealengine.com/u/Thunderpwn)\
**Post date:** [March 9, 2024, 7:51pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/75 "2024-03-09T19:51:50Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![xraygunner](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xraygunner](https://forums.unrealengine.com/u/xraygunner)\
**Post date:** [June 2, 2024, 3:53am UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/76 "2024-06-02T03:53:46Z")

</div>

Seriously?.. Ugh!.. I’ll open up my old file and see what’s going on. SONOFA!!!

---

<div class="post-metadata">

**Author:** ![johnny1up](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@johnny1up](https://forums.unrealengine.com/u/johnny1up)\
**Post date:** [June 16, 2024, 4:19am UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/77 "2024-06-16T04:19:43Z")

</div>

I can confirm that this is still an issue in 5.3.2. I haven’t updated to 5.4 yet (I doubt it’s fixed, but I’ll give it a go). Also, I can confirm that any values (no matter how small) for Min Contact Offset and Max Contact Offset do not resolve the issue. Implementing a golf game and this has me on a two-week workaround for putting. Wooo.

---

<div class="post-metadata">

**Author:** ![johnny1up](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@johnny1up](https://forums.unrealengine.com/u/johnny1up)\
**Post date:** [June 18, 2024, 8:40pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/78 "2024-06-18T20:40:30Z")

</div>

I just jumped into the 5.3.2 source code and it appears that the min and max contact offsets are clamped at appropriate values. I’m not sure why it’s not helping, then, so I’ll keep digging. But if anyone else knows, please do let me know.

```auto
	UPROPERTY(config, EditAnywhere, Category = Simulation, meta = (ClampMin = "0.001", UIMin = "0.001"))
	float ContactOffsetMultiplier;

	/** Min Contact offset. */
	UPROPERTY(config, EditAnywhere, Category = Simulation, meta = (ClampMin = "0.0001", UIMin = "0.0001"))
	float MinContactOffset;

	/** Max Contact offset. */
	UPROPERTY(config, EditAnywhere, Category = Simulation, meta = (ClampMin = "0.001", UIMin = "0.001"))
	float MaxContactOffset;

```

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [June 18, 2024, 8:50pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/79 "2024-06-18T20:50:14Z")

</div>

It’s probably chaos thats creating chaos.

If you manage to swap a source build back to physx you probably won’t have any issue at all.

And as far as fixing chaos gos, good luck. The name was purpously chosen to make a mess of something that worked / the whole engine.

---

<div class="post-metadata">

**Author:** ![johnny1up](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@johnny1up](https://forums.unrealengine.com/u/johnny1up)\
**Post date:** [June 20, 2024, 1:10pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/80 "2024-06-20T13:10:29Z")

</div>

Just an update on this for anyone who stumbles onto this thread. I managed to fix this (at least, so far) by setting the value of the Max Substep Delta Time (in Project Settings → Physics) to 0.0013. Doing this completely solved the issue. However, this does affect performance, so I’ve optimized everything where possible (only using CCD when necessary and otherwise clean/optimized code when it’s on). But this did not require any engine source code changes, nor any complex workarounds. It’s not the best option, but it works.

---

<div class="post-metadata">

**Author:** ![Thunderpwn](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Thunderpwn](https://forums.unrealengine.com/u/Thunderpwn)\
**Post date:** [August 18, 2024, 5:13pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/81 "2024-08-18T17:13:36Z")

</div>

and this is still working?

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [August 18, 2024, 11:18pm UTC](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461/82 "2024-08-18T23:18:27Z")

</div>

It never did.  
Setting substep works for that specific computer on that specific processor.

Anything that is slightly slower will likely have the very same issue.

[Previous page](https://forums.unrealengine.com/t/rolling-ball-jumps-on-flat-surface/37461.md?page=3)
