Demo entry 6714556

jh

   

Submitted by anonymous on Feb 14, 2018 at 20:20
Language: Lua. Code size: 642 Bytes.

function Node:onTick()
	if (self.active==false) then
		return
	end
	i = "juhjh"
	-- 989898
	tm = getUniverse():getTimeline():getTimeElapsedFromLastTick()
	impulsesPerSec = 20
	impulses = tm:toSeconds() * impulsesPerSec
	nodes = {}
	self:getSpace():getChildNodes(nodes)
	for i=1,#nodes do
		rb = nodes[i]:getRigidBody()
		if (rb and nodes[i] ~= self:getParentNode()) then
			dist = (self:getWorldPosition() - nodes[i]:getWorldPosition()):length()
			dir = (self:getWorldPosition() - nodes[i]:getWorldPosition()):getNormalized()
			inv_sq = 1/dist*dist * impulses
			rb:applyCentralImpulse(dir*rb.mass*inv_sq)
		end
	end
end

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).