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}
Description
Details
- Legacy ID
- 2413140756
- Severity
- None
- Resolution
- Fixed
- Reproducibility
- Always
- Category
- Scripting
- Start attached "setPos-getPos.Stratis.rar" mission in Editor.
- Observe H-Barrier on the beach.
- Select "obj setPosASL getPosASL obj" in action menu and activate it.
- Observe that H-Barrier changed position.
- Select "obj setPos getPos obj" in action menu and activate it.
- Observe that H-Barrier changed position.
Video: http://youtu.be/-JdZ8lKkQ_M
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
DEV. 126875
two new scriptinng commands has been added - getPosWorld/setPosWorld
will be distributed within next DEV build
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 :)
Mass-closing all resolved issues not updated in the last month.
Please PM me in BI Forums (http://forums.bistudio.com/member.php?55374-Fireball) if you feel your bug was closed in error.