• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Melee] calculating exact position on the map spherical

Status
Not open for further replies.
Level 4
Joined
May 27, 2010
Messages
9
OK I am trying to make a 10 player melee map which has huge spherical design influences and I am wondering if somebody can help me out with some maths

(this next image is photoshopped)



for example you all see the Gold mine near the Red starting zone.

the position of the mine is 2800, 4855

my question is as follow with the coordinates of the red starting mine, how can I calculate any other position on the map with the same spherical distance from the middle as the red start mine?

I am an extreme noob about this so please keep it as simple as possible :)

the answer would help me out alot :ogre_haosis:
 
First, get the coordinates of the middle zone (for this example, let's choose (100, 100)). Next, determine what distance you want (for this example, let's use 2000).

Now, let's say you placed a gold mine. In your case, you placed it at (2800, 4855) (approximately). You can calculate the distance between that point and the middle point like so:

distance = SquareRoot( (2800-100)^2 + (4855-100)^2 )
[SquareRoot((x2-x1)^2 + (y2-y1)^2)]

It is about 5468. Now, that is really off from our target distance of 2000. Let's say we want to make it 2000, but keep the angle. You would first calculate the angle between the two points:

Atan( (4855-100) / (2800-100) ) = about 1.0544

That will return the angle in radians [formula: Atan( deltaY, deltaX )]. Then you can just calculate polar projection (polar projection = a point offset by some distance towards an angle):

x-coordinate = 100 + 2000 * Cos(1.0544)
y-coordinate = 100 + 2000 * Sin(1.0544)

Thus, you should place your gold mine around the coordinates:
( 1087.50, 1839.21 )

I know this sounds complicated, but it is mostly just plugging things in. You can use either a calculator or some online calculator like wolframalpha. This is only if you want it to be really precise, though. You can usually just guesstimate and get it to be fairly balanced, as sonofjay said.
 
Last edited:
Status
Not open for further replies.
Top