Camera Update On RenderStepped or Heartbeat

I heard it was good practice to keep camera updates on renderstepped, but I found out that there are no jittering issues in my case if I update it on heartbeat after all my cframe/physics operations.

How should I go about this?

From their documentation (RunService | Documentation - Roblox Creator Hub, RunService | Documentation - Roblox Creator Hub) they fire the same amount of times. That is the reason that you do not notice any jitter.

However, the order in which these functions are called is different. Heartbeat fires after the physics is completed while RenderStepped fires before the frame is rendered. Why is that important? For performance. As I understand it, RenderStepped will literally block the rendering of the frame while heartbeat does not (it runs in parallel, if the computation takes longer I assume that the frames still get rendered but the effects of the heartbeat show up in later frames). That is the reason for which you should be using RenderStepped only with stuff that is important to rendering, such as camera or character movement.

Now to answer your question, if you use HeartBeat instead of RenderStepped, there might be situations where some frames will render without the cframe updates of your camera (due to other heartbeat computations or physics taking longer to compute). Conclusion, you will probably not notice the difference until your game grows (more parts for more physics computations or more heartbeat calls, etc).

Sorry for long post. Anybody feel free to correct me, that is what I understood from the documentation.

EDIT: One thing I forgot to mention is that the documentation mentions that these functions are called a variable number of times depending on your system and the computation load. What I try to explain above is that this variation is not the same for Heartbeat and RenderStepped.

3 Likes

That’s what I was concern with. I’m aware that heartbeat runs in parallel with rendering but I always wondered what would happen if the computations under heartbeat actually take longer than the actual rendering itself. What happens then? The rendering effects heartbeat actually render the next few frames? Can someone confirm this?

EDIT: Appreciated your input a lot!

1 Like