View Single Post
10/24/23, 05:19 AM   #15
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
Question

This is an extreme necro but its the only relevant thread that comes up in google.

Im looking to detect the range of a group unit for mounting purposes. Specifically needing know if theyre within approx 8-10m range but not exactly sure yet until I can properly calculate this. I've been exploring some of the samples listed above and some other stuff I found in a couple other addons but havent got anything to give me a distance only positions.

so far the easiest setup using reticle target for testing I found in an addon "Shadow image range" but doesn't work either.

Code:
local selfZone, selfX, selfY, selfZ = GetUnitWorldPosition('player')
local targetZone, targetX, targetY, targetZ = GetUnitWorldPosition('reticle')
local distance = zo_distance3D(targetX, targetY, targetZ, selfX, selfY, selfZ) / 100
df(tostring(zo_round(distance)))
SetRangeTracker has very similar setup but with this calculation instead:
Code:
local distance = zo_sqrt((selfX - targetX) ^ 2 + (selfY - targetY) ^ 2 + (selfZ - targetZ) ^ 2) / 100
any suggestions?

Last edited by sinnereso : 10/24/23 at 05:43 AM.
  Reply With Quote