The position value reported by script commands for backpack objects is incorrect. It appears to be approximately double it's real value.
Affected commands:
position
getPos
getPosASL
getPosASLW
getPosATL
visiblePosition
visiblePositionASL
Description
Details
- Legacy ID
- 2341800294
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Category
- Scripting
- In mission editor, create a new mission
- Place a player unit (any kind of man unit)
- Place an empty backpack nearby. Give it a name (eg. myPack)
- Preview mission
- Press escape to load debug console
- In first watch field, enter "position player"
- In second watch field, enter "position myPack"
- Observe reported position of myPack is approximately double that of the player
Event Timeline
You borked it BIS!
Just to add.
backpack created with createVehicle and not editor placement also reports incorrect coordinates
backpackObject modelToWorld [0,0,0] however gives correct coordinates.
Discovered this today. With a backpack named "thepack," entering "hint format["Me: %1\nPack: %2",getPos player,getPos thepack];" into the debug console resulted in this, showing two very different coordinates: http://i.imgur.com/ZvuRBqb.jpg
This seems to be related to an issue creating backpacks through scripts...
_position = getPosATL player;
_position set [2, (_position select 2) + 0.5];
_b = createVehicle ["B_FieldPack_cbr", _position, [], 0, "CAN_COLLIDE"];
When the pack is created it gets moved away from the player, presumably so it doesn't collide, even though "can_collide" is specified. The pack will then jump between the created position (_position) and the position the engine moved it to, depending on the view angle. If the moved to position is within the camera view it will appear there. If it's not it will appear in the original location. This seems to only be an issue with backpacks. Changing this to create a crate, for example, acts as expected.
Backpack created in editor returns reference to actual backpack container inside its parent weaponholder. In order to get the position of the weaponholder use objectParent
getpos objectParent myPack
reports correct position https://community.bistudio.com/wiki/objectParent
Does this resolve this issue for you?
Yes, that returns the correct result. Thanks for the info.
Backpacks seem a little difficult, as other similar container-like object types that exist in weaponholders (weapon, vests, uniforms etc) are handled differently, as the returned object if you name the "entity" (placed in the editor) is the weaponholder, not the contents.