Home   Help Search Login Register  

Author Topic: Positioning objects on the same level  (Read 1006 times)

0 Members and 1 Guest are viewing this topic.

Offline Rellikki

  • Members
  • *
  • Die-hard OFP player
Positioning objects on the same level
« on: 04 Dec 2010, 22:40:01 »
Is there a way to place objects side by side on the same exact level, despite the terrain level? This wouldn't be a problem with the ArmA commands setPosASL and getPosASL, but is there any way to do that in OFP?

Walter_E_Kurtz

  • Guest
Re: Positioning objects on the same level
« Reply #1 on: 05 Dec 2010, 02:01:52 »
Trigonometry, dear boy. Trigonometry.

You need to place a third object on the line that bissects the first two. Then compare the distances from that to each of your original objects.

I'm attaching a sample mission to show what I mean: Radio Alpha shows how far each flagpole is from the barrel; Radio Bravo raises the left flagpole by half a metre. Raise it twice and they're approximately level.

It should be possible to create a script that handles the three objects:
   - place trig point on the bissecting line
   - check distance to the other two objects
   - calculate how much to move one of the objects
   - perform the move
   - delete the trig point
but I'm afraid my brain's not in a state to handle the mathematics just at the moment.

Offline Rellikki

  • Members
  • *
  • Die-hard OFP player
Re: Positioning objects on the same level
« Reply #2 on: 06 Dec 2010, 04:43:00 »
Thanks for the help, but a friend of mine found a solution:

You'll need to use the ASL function from Editor's Depot and call it on both objects. To get the second object aligned on the same level with the other one, you'll need to subtract the to-be-aligned object's ASL from the other one's and use the result as the Z coordinate when setPos'ing it. Works like charm. :)