Jump to content
_SCAR

Set object altitude in script?

Recommended Posts

All,

I'm trying to set the altitude of a pipe (class is  Land_IndPipe1_20m_F). The pipe is oriented to terrain normal.

 

The issue is that the pipe's inclination gets completely messed up. This is the pipe in the editor:

 

3yx1xvGRxo.jpg

 

This is the pipe after setting its altitude from a script:

 

AJXjMB9b4r.jpg

 

Things I've tried:

_currentPipe setPos [getPos _currentPipe select 0, getPos _currentPipe select 1, _altitude];
_currentPipe setPos (_currentPipe modelToWorld [0, 0, _altitude]);
_currentPipe setPosATL (_currentPipe modelToWorld [0, 0, _altitude]);
_currentPipe setPosATL [getPosATL _currentPipe select 0, getPosATL _currentPipe select 1, (getPosATL _currentPipe select 2) + _altitude];
_currentPipe setPosASL [getPosASL _currentPipe select 0, getPosASL _currentPipe select 1, (getPosASL _currentPipe select 2) - _altitude];

To no avail. ...Any ideas?

 

Thank you,

 

_SCAR

 

Share this post


Link to post
Share on other sites

Ok answering myself here. I guess this has to do with the fact that this object is primarily oriented at SEA level, hence the issues if you use it with TERRAIN orientation. I don't know, 50% of Arma programming is random guesses.

 

This fixes it (edit: no it doesn't)

_currentPipe setPosATL [getPosATL _currentPipe select 0, getPosATL _currentPipe select 1, _altitude];
_currentPipe setVectorUp surfaceNormal position _currentPipe;

 

  • Like 1

Share this post


Link to post
Share on other sites

Not really, no.

 

Still I don't understand why this moves the object:

_obj setPos (getPos _obj);

...anyone cares to explain it to me...?

 

Thank you,

_SCAR

 

Share this post


Link to post
Share on other sites

Thinking this might be a problem of collision, I even tried:

_obj setVehiclePosition [getPos _obj, [], 0, "CAN_COLLIDE"];

which also moves (and rotates) the object. WTAF.

Share this post


Link to post
Share on other sites

Going further: running this multiple times MOVES THE OBJECT everytime this is called:

_obj setVehiclePosition [[9242, 1009, 0], [], 0, "CAN_COLLIDE"];

 

Share this post


Link to post
Share on other sites

Ok for anyone curious, I found the *only* one that works:

 

_obj setPosWorld getPosWorld _obj;

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×