Anyway, here is the function I use for the basic nuke path curves.
Code: Select all
function GetNextNukePos (startX,startY,targetX,targetY,curPosX,curPosY)
local relDist = (distance(curPosX,curPosY,targetX,targetY)/distance(startX,startY,targetX,targetY))
local angle = math.pi/3*relDist+(math.atan2(targetY-curPosY,targetX-curPosX))
local speed = ((0.01+0.01*(1-relDist)^2)*GetGameSpeed())
local nextX = curPosX + math.cos(angle)*speed
local nextY = curPosY + math.sin(angle)*speed
return nextX, nextY
end
where distance is a simple function to calculate the distance of 2 points.