I'm trying to figure out for to create a function similar to "Point With Polar Offset" but a 3D version.
For my map I have the players main unit in the center of the map (x128y128z0) and another unit far away (x675y382z934). Since this other unit is too far away to show I want to get the angle difference, use a 3D version of "Point With Polar Offset" with a distance of 128, then scale the unit down to make it seem far away.
Hello.
I'm trying to figure out for to create a function similar to "Point With Polar Offset" but a 3D version.
For my map I have the players main unit in the center of the map (x128y128z0) and another unit far away (x675y382z934). Since this other unit is too far away to show I want to get the angle difference, use a 3D version of "Point With Polar Offset" with a distance of 128, then scale the unit down to make it seem far away.
you need a and q angels. l is 2d distance. a is 2d angle, and q is the angle between vector (from source to target) and the surface
a = atan2(dx, dy)
l = sqrt(dx^2, dy^2)
q = atan2(l, dz)
to get dx, dy, and dz back, you use these:
x = r * cos (q) * cos(a)
y = r * cos(q) * sin(a)
z = r * sin(q)
r = 128 for you
or (if you meant l = 128), r = 128 * cos(q)
Wanted to know if my understanding is correct or wrong.