Simulated BodyVelocity provides incorrect Force

Hello, I’m len_ny and I’ve recently been trying to replicate Roblox’s BodyMover object’s internal simulation logic to allow the client to simulate what the server is trying to simulate.

Let me explain, say we have an NPC on the server and it takes knockback. The server may be slightly overloaded at the moment and can’t tell the clients where the object should be for the simulation fast enough. With that we see something like this unfold:

This problem occurs often enough to warrant this, optional, solution. I want to have the client simulate the velocity, and then have the server notify the client where the server’s simulation ended, and teleport the client object to that position.

So here I come to my dilemma… My calculations are off, but the math should be correct. Here’s what I mean:
download (3)
download (1)

When printing out the properties Velocity & AssemblyLinearVelocity both would gradually raise to 0, 0, 2. So from my point of view, this math should as well. You may notice I have a custom linearVelocity property since I can’t rely on Roblox’s as I am not using their simulator, but this had a negative effect as well. If I add to it the simulator instead gradually goes from full force to no force at all on the object. Obviously, I need to inverse this and that isn’t tricky, but I feel I, as a mediocre mathematician, should call in some help before I try to bandaid every problem.

velocity.rbxl (44.0 KB)

1 Like