Looking for someone with knowledge of the UE4 physics Engine

Hi,

I am looking for someone with a strong understanding of the UE4 physics engine (I believe it is PhysX) that may be able to help me solve a problem that has been plaguing my project since its inception 4 years ago.

The Problem:
The game I have been working on is a rolling ball platformer. You essentially play as a ball which is controlled through applying force and torque based on inputs. Little naive old me thought this would be a good, simple place to start learning game development back in the day, and my love of Marble Blast Ultra back on the 360 made it seem like the perfect project to start messing with.

I very quickly ran into an issue with collision when rolling over modular mesh pieces, which was going to be my intended method of creating levels for the game.

After some brief research on the issue, I found a few posts of people having similar issues, and that they were finding that setting the “Min Contact Offset” and Max Contact Offset” to their smallest possible values fixed the issue. After trying this myself, it did infact appear on the surface to fix the collision issue. My ball would no longer randomly bump up into the air when rolling over the seam of two modular pieces.

Unfortunately this is not the end of the story though…

I soon found out that the issue still existed when I implemented a jump mechanic in the game. Upon re-impact with a connection seam, the ball would calculate the collision based on one of the internal faces instead of the actual surface faces. The same would also happen with two connecting planes, as depicted in this image.

The image shows two planes seemingly connected perfectly together. When the ball comes in from a jump, you would expect the trajectory to follow the green arrow, but if the seam of the two planes is hit, the ball will actually follow the red arrow trajectory, or sometimes simply just stop in its path. Its as if the physics calculation thinks the ball has hit a corner (like the one depicted in red).

So this discovery destroyed every thought of using modular pieces to create the levels for my game. I had to find a new solution… I eventually realised that creating entire levels out of a single mesh in blender was a valid solution. It still had some minor collision issues when it came to the top edges on ramps, but it was something I could live with for my project.

I continued to create levels in this way for the next few years as I worked on the project in my spare time. During this time, the game has progressed a decently long way to the point where I was recently able to release my game into Early Access on steam which I am very happy with.

After some feedback on the game, a big feature that people are asking for is a level editor. As well as being requested by my community, I have always wanted to include one anyway, but had to shelf the idea upon the discovery that I would not be able to use modular pieces for designing levels. I feel that this is the next step for my game though, so I feel it is time to revisit this problem, and this is where I need the help of someone with experience in this field.

I recently made the discovery that when starting to mess around again was that unreal geometry seemingly reacts differently than a static mesh, which has made me wonder if this problem may have a solution within my reach after all.

The video below shows me jumping on the seam of two static mesh objects and then two geometry objects. It is very clear to see that there is some sort of difference when it comes to the physics calculations being done, and that is what I am hoping to solve with this post!

Video of collision issue in action

I really appreciate any help or information anyone can provide <3
Thanks!

What kind of collision geometry are you using?
Mesh, box, k-DOF, convex, …?

My expectation is that, if you make each modular piece have a simplified collision volume that’s a box, and NOT use a mesh collider, then you’d see better/smoother response.
Mesh collision is pretty finicky, and even the convex hulls can be trouble, but the boxes are pretty robust.

currently all of the meshes in my game use the collision “use complex collision as simple”, but I have also tried with simple collisions (by adding a simple box collision) and they both seemingly have the same problem with it comes to bad collision detection.

I am curious why the ue4 geometry works perfectly fine when stacked side by side, but a simple cube mesh (complex and simple collision) seems to have issues. Its as if the physics engine code is differentiating between the different types of objects an using different calculations, with the geometry calculation being the preferable option.

Even the example with the simple planes, they both used simple box collisions with a thickness of 0 and they still act as if they have a corner to collide with when they shouldn’t.

Have you turned on collision visualization to see what the engine actually outputs?

Both visualizing the collision geometry, and visualizing the detect collision penetrations/forces, can be helpful.

So I just tried visualising collisions and it turned on the collisions for each object. How would I then also see the penetration/forces etc? I was unable to find a command to also turn those on.

One thing I did notice however is that the geometry objects didn’t appear to have any visible collision when I used the “show collisions” command.

I’m fairly new to all of this and my past experience of debugging my game pretty much only includes the output log and print strings xD

Thanks!

I honestly don’t recall if there’s a built-in way to visualize contacts.
You may have to turn on receiving hit events for the sphere, and draw the hit normal / depth parameters using the “draw debug line” function.
By default, a normalized vector is very small in Unreal space, so you may also need to scale it by 100x or so.
And then draw it with “stay on screen for 5 seconds” so you have a chance to see it before it’s gone, especially if it jitters around.