Pass in dt to BindToRenderStep function

RunService:BindToRenderStep takes a function to call on the render loop. A dt parameter for the amount of time elapsed since the last render loop iteration should be passed to this function. I find myself computing dt manually almost every time I use BindToRenderStep.

The RunService.RenderStepped event passes dt to its listener but, as you probably know, it’s much more limited than BindToRenderStep since you can’t specify priority.

23 Likes

In what scenario would this be useful?

1 Like

Say I want to animate something with a varying, unpredictable velocity. For example, gun recoil. Every time the player shoots the gun, its velocity changes. I need a function to update the gun’s CFrame every render loop. This function needs to know dt to know how much to displace the gun.

In general, dt is essential to almost all physically based animation.

2 Likes

In one of my upcoming projects, I’m handling all animations and effects locally to keep space for the server and network to do more important things. This means that animations can be handled at different speeds for each user which isn’t very desirable. Right now i’m using a self-made delta time method to size, position, and animate things correctly based on the time between the last frame and the current frame.

I believe having a built in system for delta time would be a lot more useful reliable.

OH i thought you were wanting to define an amount of time to wait between each call.

Yeah of course we should give you a delta value. I thought were already were :confused:

4 Likes

It’s passed in a regular connection to Renderstepped, but not functions bound using BindToRenderstepped.

1 Like

This would be a great addition. I need to use a delta time value for just about every render-binded function I use.

3 Likes

Any update on this?

3 Likes

I think these provide some very valid use cases. We will need to look into this a bit more assess if this is something we want to implement.

Shipped.

API: http://wiki.roblox.com/index.php?title=API:Class/RunService/BindToRenderStep

9 Likes

YYEESS thank you!

1 Like

Almost anything for you man. Almost.

3 Likes

Am I missing something or does the documentation still pretend that there’s no dt parameter?

3 Likes

Documentation likes to pretend there’s no dt parameter.

1 Like