Identical method to Unity's FixedUpdate?

I am writing raycast based car chassis but it needs to run at fixed rate independently from the frame rate. If I use heartbeat it will be affected by frame rate and as of result the rate will fluctuate, which will cause the chassis to misbehave due to forces being applied inconsistently.

I need something like FixedUpdate which can be found in Unity’s game engine.

void FixedUpdate() {
  // ...
}
1 Like

IIRC, isn’t Unity’s FixedUpdate fired for every physics frame? If so, you could try using RunService.Stepped.

Roblox states in their engine documentation that the rate will vary depending on the performance of the machine, which is not what I am looking for.

Unless you use the deltaTime of the heartbeat and times it to the cars momentum, I honestly don’t think there’s a roblox equivalent to Unity’s FixedUpdate… Hopefully I’m wrong, though.

I found an old topic which found a solution to something similar to this a while ago, so I wrote a fixed update module.

Also to vouch for the module I’m using it in my game DashBlox for the physics overhaul/rewrite that I am currently working on, It’s also being used in my game RoStrike, and I will use it again when I attempt a 1-1 port of source engine movement to Roblox.

3 Likes

this sadly is not equivelent to unitys fixed update

would be interested to know what the differences are

Roblox’s physics update runs at 1/240hz / 240fps; Because of this roblox does it entire physics simulation between RunService.PreSimulation and RunService.PostSimulation (I believe) and because of this you only see the results of the physics step at RunService.PostSimulation. Which means in your accumulator yes you may run your code at 240 fps however your updates into the physics engine are not reflected until after PostSimulation which is why it’s not as simple a fix as that and instead you have to integrate the physical bodies yourself with their inertia tensor etc… See here

yea it doesn’t tie into roblox physics, I only use this for custom physics stuff or when I need something to be framerate independent.

in dashblox (in the new update which isnt out yet) and in rostrike/my source movement port, I’m not using roblox physics at all.

i also never claimed this to be equivalent to unity’s fixedupdate? its just a simple wrapper around a time accumulator.

Ah well fair enough then, I thought you were talking about integrating with the physics loop