mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Fix spring impulse control
This commit is contained in:
parent
f370e3f841
commit
cf58410b89
3 changed files with 131 additions and 93 deletions
|
|
@ -2120,6 +2120,31 @@ TEST("spring()", wrap_root(function()
|
|||
step(0) -- process spring queue
|
||||
CHECK(count == 1) -- check spring was rescheduled correctly
|
||||
end
|
||||
|
||||
do CASE "spring control"
|
||||
local input = source(1)
|
||||
local output, control = spring(input)
|
||||
|
||||
local value = input()
|
||||
local count = 0
|
||||
effect(function()
|
||||
value = output()
|
||||
count += 1
|
||||
end)
|
||||
|
||||
CHECK(count == 1)
|
||||
CHECK(value == 1)
|
||||
|
||||
control { impulse = 1 }
|
||||
|
||||
CHECK(count == 1)
|
||||
CHECK(value == 1)
|
||||
|
||||
step(1/120 + 0.001)
|
||||
|
||||
CHECK(count == 2)
|
||||
CHECK(value > 1)
|
||||
end
|
||||
end))
|
||||
|
||||
TEST("untrack()", wrap_root(function()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue