Jaylee
0
Q:

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
0

New to Communities?

Join the community