Home   Help Search Login Register  

Author Topic: how can I determine the real "height"  (Read 514 times)

0 Members and 1 Guest are viewing this topic.

Offline Blanco

  • Former Staff
  • ****
how can I determine the real "height"
« on: 20 Sep 2004, 02:59:39 »
I'm sure there was a script for this some time ago, but I can't find it anymore...it was pending about a month ago I think

how can I determine the "real" altitude in which a unit is placed?

for example :

let's say _unit is placed in a tower (7m high) with a setpos command
Code: [Select]
_unit = _this select 0

_posx = _unit select 0
_posy = _unit select 1
_posz = _unit select 2

ok,_posz should be 7...

When I want him to setpos him again in his original position with...
Code: [Select]
_unit setpos [_posx,_posy,_posz]

The unit is always placed on the ground instead of 7m high...

I know the problem, all I wanna know is : where is that script that solved this?



Search or search or search before you ask.

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:how can I determine the real "height"
« Reply #1 on: 20 Sep 2004, 11:00:55 »
getpos _unit select 2 will give you the unit's height so..
Quote
_unit = _this select 0

_posx = getpos _unit select 0
_posy = getpos _unit select 1
_posz = getpos _unit select 2

_unit setpos [_posx,_posy,_posz]
should work.
Not all is lost.

Offline Blanco

  • Former Staff
  • ****
Re:how can I determine the real "height"
« Reply #2 on: 20 Sep 2004, 14:13:09 »
Damn  :-[ , that was what I meant, I forgot the getpos command in my previous post...

No , that doesn't work.

The unit is always setpos-ed on sea level...
I've found a way but the script I was talking about was more precise.

First I create a gamelogic and setpos him on the unit. Then I check the distance between the logic and unit and store this value in a variable and use it later when i setpos him again at his original position.

Code: [Select]
_unit = _this select 0

_posx = getpos _unit select 0
_posy = getpos _unit select 1
_log = "logic" camcreate getpos _unit
_posz = _log distance _unit

;then later in the script

_unit setpos [_posx,_posy,_posz]
Search or search or search before you ask.

Kammak

  • Guest
Re:how can I determine the real "height"
« Reply #3 on: 20 Sep 2004, 18:29:58 »
Very nice!  This will come in quite handy when finding positions for mission making!  Thanks.
« Last Edit: 20 Sep 2004, 18:52:05 by Kammak »

Offline Blanco

  • Former Staff
  • ****
Re:how can I determine the real "height"
« Reply #4 on: 29 Sep 2004, 05:59:38 »
This is the script (function) I was talking about  :)
Search or search or search before you ask.