Answers for "lua verlet integration"

Lua
0

lua verlet integration

self.canBreak
self.restDist, self.breakDist

local sep = (p1 - p2)
local fac = (self.restDist - sep.magnitude) / sep.magnitude

local restore = sep * 0.5 * fac
point1.pos = not point1.inert and point1.pos + restore
point2.pos = not point2.inert point2.pos - restore

if self.canBreak and sep.magnitude > self.breakDist then
	self:tear()
end
Posted by: Guest on January-28-2020

Browse Popular Code Answers by Language