User:Furion: Difference between revisions

From WolfWiki
Jump to navigation Jump to search
Furion (talk | contribs)
Added dist()
 
Furion (talk | contribs)
m fix
Line 13: Line 13:
return math.floor(d) / 39.37
return math.floor(d) / 39.37
end
end
</pre></nowiki>
</nowiki></pre>


More stuff coming soon :>
More stuff coming soon :>
[[Category:ETPro:Mods]]</pre>
[[Category:ETPro:Mods]]</pre>

Revision as of 20:45, 9 February 2007

Hello There ;p

dist() Function

For distance between two object with vec3 position values

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

More stuff coming soon :>