Home   Help Search Login Register  

Author Topic: Easy way to calculate distance?  (Read 355 times)

0 Members and 1 Guest are viewing this topic.

kernel_clink

  • Guest
Easy way to calculate distance?
« on: 23 Feb 2004, 18:16:54 »
Hi,

Im trying to get back into OFP mission making and my first little project is to make a virtual test range. I was wondering if there is a easy way to calculate distances ? or what is the easiest way to set targets at 'real' like distances, 100,200,400 meters ? from my shooter's position?

THanks in adv

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:Easy way to calculate distance?
« Reply #1 on: 23 Feb 2004, 18:31:30 »
To determine the distance between two objects you can use the distance command;

Object1Name distance Object2Name

Will return the distace between the two objects.

If you wanted to set targets at certain distances, you'd use the setpos command,

TargetObject Setpos [(Getpos Player Select 0) +100, Getpos Player Select 1, 0]

This line would set the named target object 100 metres east of the player unit.  Its easier if you want to set the distances in either north, east, sourth or west directions as you can just change the value of the offset (the +100 in this case) and move it to either the select 0 (east/west) or select 1 (north/south).

Moving it off in any other directions (north-east for example) would still be simple, it just requires some trigonometry.
« Last Edit: 23 Feb 2004, 18:31:55 by [icarus_uk] »

kernel_clink

  • Guest
Re:Easy way to calculate distance?
« Reply #2 on: 23 Feb 2004, 20:06:54 »
Of course it had to be easy  ;)  Thanks, i remember using that a long time ago to spread out teams.....some of the rust is starting the shake off, thanks