mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Add check for unstable spring parameters
This commit is contained in:
parent
a543a24865
commit
835f4d429b
2 changed files with 8 additions and 3 deletions
|
|
@ -161,6 +161,11 @@ local function spring<T>(source: () -> T, period: number?, damping_ratio: number
|
|||
local c_c = 2*w_n
|
||||
local c = z * c_c
|
||||
|
||||
-- todo: is there a solution to this other than upping step frequency?
|
||||
if c > UPDATE_RATE*2 then -- solver will explode if this is true
|
||||
throw("spring damping too high, consider reducing damping or increasing period")
|
||||
end
|
||||
|
||||
local data: SpringData<T> = {
|
||||
k = k,
|
||||
c = c,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue