Lua verlet integration

This article is tagged with: Lua verlet integration and lua

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

This article is tagged with: Lua verlet integration and lua