Download

Integrating Bullet Physics into UE4

Hey folks,

so, for our competitive networked vehicle multiplayer game, we needed a stable and controllable network client-side-prediction method. I tried for over half a year to implement it with physx, and I’ve tried so hard, and came so far, but in the end, it doesn’t even matter!

Jokes aside, the physx solution came pretty close, but wasn’t playable in a release game. So I decided to integrate Bullet Physics into UE4, and it’s working way better. WAY better. The controll you have over everything is just such a pleasure, compared to physx. Ofcourse, you have to do more yourself, but it’s worth it. 300ms client-side-prediction (on smooth underground) prooved an accurarcy of 99.8% so far, in a real-conditions test.

So, enough of that.

**I wanted to ask, if someone else has some experience with Bullet **(in or outside of UE4). One thing I still struggle with are complex triangle meshes. Our Vehicle Hitboxes are just a rectanlge, so I use convex hull collision, but btBvhTriangleMeshShape has no optimal collision, for convex static shapes. I wonder what you would recommend to build the environment out of. :slight_smile:

Another thing that confused me at the beginning was the center of mass, which in bullet you apparently can’t change. It’s always the origin of the mesh. Thats pretty annoying, to be honest, and I solved it by using a convex hull of a cube, with origin where I want the COM to be. Than I extract vertices and indices from the LODRessources from the static mesh and feed them to bullet into a convex hull. Is there maybe an easier way of approaching this?

I’m also curios about this, I decided to go for bullet for the exact same type of game and reasons.

Regarding COM, what purposes are you changing it for?
You may have come across this, but there are some info here: http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=2209
It does seem like it’s not straightforward though.

If by chance you are changing the COM to keep the vehicle upright when it’s about to tip over, perhaps a ‘keep upright’ (spring force) constraint may help instead?