Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Author: XaskeL
- -- Fix for circle radar. From RCCDPlanet.
- local function findRotation(x1,y1,x2,y2)
- local t = -math.deg(math.atan2(x2-x1,y2-y1))
- if t < 0 then t = t + 360 end
- return t
- end
- local function getDistanceRotation(x, y, dist, angle)
- local a = math.rad(90 - angle)
- local dx = math.cos(a) * dist
- local dy = math.sin(a) * dist
- return x+dx, y+dy
- end
- function repairCoordinates(blipPosX, blipPosY, blip)
- local radius = 130
- local newX,newY = blipPosX, blipPosY
- local angle = -findRotation(0, 0, blipPosX, blipPosY)
- local px,py = getDistanceRotation(radar.center.x, radar.center.y, radius, angle)
- local distx = getDistanceBetweenPoints2D(blipPosX, blipPosY, 0, 0)
- if distx > radius then
- newX = px - radar.center.x
- newY = py - radar.center.y
- end
- return newX,newY
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement