Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for i = 1, max_targets do
- if targets[i] then
- -- calculate radar's values in radians
- azi_rad = target_azi[i] * pi2
- ele_rad = target_ele[i] * pi2
- -- local "unrotated" values
- target_x_unrot = math.sin(azi_rad)
- target_y_unrot = math.cos(ele_rad)
- -- rotate the radar values around the roll and pitch
- target_x = ((target_x_unrot * math.cos(roll)) + (target_y_unrot * math.sin(roll))) * target_dst[i]
- target_y = (-(target_x_unrot * math.sin(pitch)) + (target_y_unrot * math.cos(pitch))) * target_dst[i]
- -- idk why those numbers are like this, but this is the least f.cky solution
- target_px = ((w/2) - target_x/2)
- target_py = (target_y/2)
- -- draw the point on the screen where the enemy should be
- screen.setColor(255, 0, 0)
- screen.drawCircle(target_px, target_py, 2) -- target point
- target_count = target_count + 1 -- update target cnt
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment