Poll:
You do not have permission to vote in this poll.
Total 0 vote(s) 0%
* You voted for this item. [Show Results]

Partially-complete gravity well script!
#11
You'd have to set a limit on how far away the part is from the gravity source.

This could be done in about 3 lines of code, actually. This might not work perfectly, since my math skills are weak at best, but, basically, I think it would work like this:

add one line to the top of the script:

gravradius = 50



then, add after this bit:

local xdist = gravitypoint.x - object.Position.x
local ydist = gravitypoint.y - object.Position.y

--new stuff

local totaldist = math.sqrt((xdist * xdist) + (ydist * ydist))
--pythagorean theorem :]
if totaldist < gravradius then
-- do rest of script; just make sure to add an extra end :]
[Image: iwn8gk.gif]
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)