Terrain segment collision issues

Hiya all.

There is an issue with the collisions at the edge of terrain segments, causing a fast moving object to jump when crossing to another segment.
Presumably, in a single step, the body will penetrate the terrain, and at the edge of a segment, it collides with the edge, rather than just the surface.

Though someone may have a better idea for a fix (like custom collision detection/response on the edge of a segment, or limiting a bodys drop on terrain)
I have an idea for a little workaround

Extend each segment by 1 square on each side, but slightly lower than the vertex it would be matching

ue4terrain.png

This should still leave us with a slight “bump” when crossing segments, but hopefully much less.

Thoughts anyone?

So - This is something I’d be interested in having a bash at implementing, my motorbike sim is going well, but invisible speedbumps in the terrain are quite an issue.
Is this something you folks think would work well enough to be worth implementing? is this something epic would be interested in me submitting a PR/MR for?
If so, I’ll get digging into the code, and see how practical it would be (for me) to implement.
If not, I may just follow the standard recommendation, and replace the collision code for my wheels with some kind of raycasting, or custom collision response

Also, is there a better place/way to discuss this?

(dupe post removed)

So, playing around in the game I am working on - Now even more convinced this is a good idea.

Test was: using the sculpt tool, and creating a tiny “dip” (using shift+click) along the seam of two terrain segments

I now experience a tiny bump when driving over at speed, on my bike with spheres for wheels, instead of bouncing into the sky and doing a flip.

I really am interested in adding this to core unreal engine, but am reluctant to invest the time in doing it if there is no chance of a PR being accepted…

From what @0lento found, this bug is somehow related to the normal of the surface being screwed on the edges. I don’t know if there is an easy fix to this and if this issue is coming from PhysX or how UE4 wraps collision for the landscape. What you describe in first post should help, don’t know if this is “proper” fix as slight bump becomes big issue for high velocity vehicles. I would check if this bug is logged in jira already.

What I would recommend is to abandon rigid-body approach for vehicle and switch to ray-traced or sweep shapes. You won’t see any issue with landscape edges. I’ve been on this path myself and while physics constraint setup has certain benefits it starts to work against you as more complexity is added. For example, most of the vehicles rely on good contact with the road (why tires are so important), with rigid-bodies it’s hardly possible as by their nature they are slightly jittering as every frame they are being pushed out from colliding geometry. Even with sub-stepping ON and doing all your calculations on sub-steps, your traction becomes dependent on how smooth your game is running.
I don’t know how realistic you are going with simulation of the bike but there is important effect of how tire friction works when bike is tilted to a side. Without custom code to process this, you’ll have to fudge it somehow on top of your rigid-body simulation and it can get ugly. In any case, good luck with bike!

Hmm, I don’t think it is exclusivly the normals at the edge of the terrain causing the problem (I get similar issues on brush/spline seams) - but it may well make it worse.

Regardless - an extra layer of sunken vertices around the edge of a terrain segment should really reduce the issue - but I’ll probably leave it unless someone actively expresses interest.

Yes - tempted to switch to rt/sweep after discovering other places where collisions do not work quite as desired - though, may try some other ideas first, perhaps increasing number of substeps even more, or something I’ve not yet thought of :smiley:

Yeah, it path worth pursuing, I’ve seen people getting really cool results with just physics constraints.

Yes - I am getting rather good results too :smiley: - latest video here: https://youtu.be/q5--JWUp4sg

Still some way to go, but very playable! One of my next tasks is to make some levels to see what needs tweaking in more detail.

enabling physics substeps and decent suspension have been the most vital steps to make physics constrains+RBwheels work well so far - sure more can be done, but the silky smooth collisions from giving it up sure do look tempting

Looks fun! I like that bike is breakable:)

Thanks! The proof of the pudding will be when I try making a varity of easy<-> hard levels, and speed/puzzle/technical types.

Right now the only way to crash is to hit the riders head, but I may alter it to allow crashing when hitting the bikes wheels/body hard enough.

Still - I wont waffle on about the game here (Started a thread for that [wip] Wheelz2 (Physics Bike game) - now in Early Access! - Work in Progress - Unreal Engine Forums will update with pics and new videos later)

I think for the improved terrain collision, my suggest hack would really help - but what really needs to happen is a physx update.
Perhaps (only if CCD is enabled?) there could be a forced collision check with the objects our wheel collided with in the previous frame, fixing position as well as velocity before performing the standard collision checks.

But that sounds rather sub-optimal, and is not only a topic for a different thread, but also probably a different forum!