User:Furion

From WolfWiki
Revision as of 20:44, 9 February 2007 by Furion (talk | contribs) (Added dist())
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Hello There ;p

dist() Function

For distance between two object with vec3 position values

<nowiki>
function dist(a ,b)
	ax,ay,az = a[1],a[2],a[3]
	bx,by,bz = b[1],b[2],b[3]
	dx = math.abs(bx - ax)
	dy = math.abs(by - ay)
	dz = math.abs(bz - az)
	d = math.sqrt((dx ^ 2) + (dy ^ 2) + (dz ^ 2))
	return math.floor(d) / 39.37
end

</nowiki> More stuff coming soon :>