mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Add control over spring solver step
This commit is contained in:
parent
5ab76a434e
commit
38f8e8d9c5
2 changed files with 39 additions and 29 deletions
|
|
@ -20,6 +20,31 @@ local flags = require(script.flags)
|
|||
|
||||
export type Source<T> = source.Source<T>
|
||||
|
||||
local function step(dt: number)
|
||||
if game then
|
||||
debug.profilebegin("VIDE STEP")
|
||||
debug.profilebegin("VIDE SPRING")
|
||||
end
|
||||
|
||||
update_springs(dt)
|
||||
|
||||
if game then
|
||||
debug.profileend()
|
||||
debug.profilebegin("VIDE GARBAGE CLEANUP")
|
||||
end
|
||||
|
||||
clean_garbage()
|
||||
|
||||
if game then
|
||||
debug.profileend()
|
||||
debug.profileend()
|
||||
end
|
||||
end
|
||||
|
||||
local stepped = game and game:GetService("RunService").Heartbeat:Connect(function(dt: number)
|
||||
task.defer(step, dt)
|
||||
end)
|
||||
|
||||
local vide = {
|
||||
-- core
|
||||
create = create,
|
||||
|
|
@ -52,24 +77,11 @@ local vide = {
|
|||
|
||||
-- runtime
|
||||
step = function(dt: number)
|
||||
if game then
|
||||
debug.profilebegin("VIDE STEP")
|
||||
debug.profilebegin("VIDE SPRING")
|
||||
end
|
||||
|
||||
update_springs(dt)
|
||||
|
||||
if game then
|
||||
debug.profileend()
|
||||
debug.profilebegin("VIDE GARBAGE CLEANUP")
|
||||
end
|
||||
|
||||
clean_garbage()
|
||||
|
||||
if game then
|
||||
debug.profileend()
|
||||
debug.profileend()
|
||||
if stepped then
|
||||
stepped:Disconnect()
|
||||
stepped = nil
|
||||
end
|
||||
step(dt)
|
||||
end
|
||||
}
|
||||
|
||||
|
|
@ -97,10 +109,4 @@ do
|
|||
})
|
||||
end
|
||||
|
||||
if game then
|
||||
game:GetService("RunService").Heartbeat:Connect(function(dt: number)
|
||||
task.defer(vide.step, dt)
|
||||
end)
|
||||
end
|
||||
|
||||
return vide
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue