Page MenuHomeFeedback Tracker

Using getPos and then setPos (getPosASL and setPosASL) on object moves it.
Closed, ResolvedPublic


There is no way to save object's coordinate and orientation and precisely restore it later. All current getPos* and setPos* commands are inconsistent between each other. Simply calling "obj setPosASL getPosASL obj" on object will not leave it in same spot as logic implies but will actually move it. {F24596}


Legacy ID
Steps To Reproduce
  1. Start attached "setPos-getPos.Stratis.rar" mission in Editor.
  2. Observe H-Barrier on the beach.
  3. Select "obj setPosASL getPosASL obj" in action menu and activate it.
  4. Observe that H-Barrier changed position.
  5. Select "obj setPos getPos obj" in action menu and activate it.
  6. Observe that H-Barrier changed position.


Additional Information

Been an issue since dawn of times (since Operation Flashpoint).

Suggested solution:

Implement new scripting commands to return and set precise object's world coordinates without any kind of manipulations in between. No placing points, no checks for surfaces underneath. Just raw world coordinates as is. Suggested names: getPosWorld, setPosWorld

Event Timeline

SaMatra edited Steps To Reproduce. (Show Details)Aug 15 2014, 12:58 PM
SaMatra edited Additional Information. (Show Details)
SaMatra set Category to Scripting.
SaMatra set Reproducibility to Always.
SaMatra set Severity to None.
SaMatra set Resolution to Fixed.
SaMatra set Legacy ID to 2413140756.May 7 2016, 7:13 PM

DEV. 126875
two new scriptinng commands has been added - getPosWorld/setPosWorld

will be distributed within next DEV build

@japapatramtara: worldToATL & ATLtoWorld plz? :)

SaMatra added a subscriber: SaMatra.May 7 2016, 7:13 PM

AgentRev, ASLtoATL and ATLtoASL commands simply add or substract distance from ground level to water level so you can use same commands for world coordinates.

Also there is no way to make world coordinate into ASL coordinate (or vise-versa) because ASL is object-specific and you will need to know object's bounding center and target orientation (vector dir and up) to calculate Z returned by ASL command.

@SaMatra: My assumption is that "world coordinates" used by these new commands are not tied to the terrain level nor sea level, but rather separate "engine" coordinates. However, there has to be a defined offset between the engine space and the terrain level or sea level, i.e. [0,0,0] in engine space could actually be above or below sea level, and it's what these commands would use to convert vectors.

I'm not sure I understand what you mean with the ASL stuff. ASL space is not object-specific, it's simply a vector relative the to flat sea level. You can have [0,0,100] which means 100m above sea at X=0 and Y=0.

The positions returned and used by getPosASL and setPosASL are, however, object-specific indeed, due to the orientation of the object altering the Z component, depending on the bounding center or LandContact vertices when available.

I guess we'll have to wait and see what "World" really means in relation to those commands.

getPosWorld is very close to getPosASL except it returns actual object Z coordinate instead of one calculated from transformation of object's placing point. Same goes for setPosWorld, it directly sets object coordinate without regard to placing point.

By object specific I meant that result of getPosASL is object specific because placing point differs between objects and there would be no way to translate world coordinate to asl coordinate without having the object itself and its placing point in model world.

Okay so, getPosWorld will return a raw ASL vector, therefore ASLtoATL can be used directly, right?

@japapatramtara one question mr wizard, what scope these new commands will operate, simulation or render? Render is better imo.

Good question, KK. Pretty sure it is simulation score. I guess we'll need visiblePositionWorld command too then :)

@SaMatra unless there is also value in having it in simulation scope just render would probably be enough, though I wont say no to more :)

AgentRev, yes, ASLtoATL and ATLtoASL will be applicable for WorldPos commands.

Mass-closing all resolved issues not updated in the last month.

Please PM me in BI Forums ( if you feel your bug was closed in error.