Bepu v2 vs PhysX

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
tomweiland
Posts: 51
Joined: Wed May 08, 2019 12:17 am

Bepu v2 vs PhysX

Post by tomweiland » Thu Sep 12, 2019 4:18 am

So I've got Bepu v2 running on my server, and I'm using Unity to render the clients. In an effort to reduce the amount of packets I'm sending, I decided not to send regular positional updates for cannonballs. Instead, I simply send over the position where they're spawned and their starting velocity. Once they collide with something I'll send another packet letting clients know to make it explode.

However, I intend to simulate the movement between those two updates locally (during that time gravity is the only thing affecting them). I was hoping that I could get away with just using Unity's built-in physics (PhysX) instead of going through the process of implementing Bepu on the client as well.
I wouldn't mind sacrificing a little accuracy, and I didn't really expect it to go well since it's two completely separate systems.

Strangely enough, PhysX's gravity seems to be stronger than Bepu's. I made sure both are using the same gravity vector as well as the same timestep, but my cannonballs lose height faster on the client than on the server.

Now, I completely understand that there's probably no way to cleanly account for this, but I wanted to ask if you had any insight on how PhysX calculates gravity or what might otherwise be affecting it. I'm not really expecting a fix (I'll probably end up sticking Bepu into Unity, unless you've got a better idea), so this question is more to satisfy my curiosity.

Norbo
Site Admin
Posts: 4723
Joined: Tue Jul 04, 2006 4:45 am

Re: Bepu v2 vs PhysX

Post by Norbo » Fri Sep 13, 2019 6:27 pm

Is it definitely only height being lost faster, or is it possibly also moving faster? There could be a difference in the frequency of timesteps (in real time).

There might also be a difference in the integration of gravity. The integrator callbacks could be modified to match if necessary.
(I'll probably end up sticking Bepu into Unity, unless you've got a better idea)
That could be difficult until some runtime bugs in unity are fixed: viewtopic.php?f=9&t=2528 :(

Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests