Page MenuHomeFeedback Tracker

Position value of backpacks is incorrectly reported by getPos
Reviewed, WishlistPublic

Description

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

Details

Legacy ID
2341800294
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting
Steps To Reproduce
  1. In mission editor, create a new mission
  2. Place a player unit (any kind of man unit)
  3. Place an empty backpack nearby. Give it a name (eg. myPack)
  4. Preview mission
  5. Press escape to load debug console
  6. In first watch field, enter "position player"
  7. In second watch field, enter "position myPack"
  8. Observe reported position of myPack is approximately double that of the player
Additional Information

Event Timeline

ceeeb edited Steps To Reproduce. (Show Details)Aug 16 2013, 6:46 AM
ceeeb edited Additional Information. (Show Details)
ceeeb set Category to Scripting.
ceeeb set Reproducibility to Always.
ceeeb set Severity to None.
ceeeb set Resolution to Open.
ceeeb set Legacy ID to 2341800294.May 7 2016, 4:03 PM

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.

Still an issue after update to 1.04.111745 (stable)

ceeeb added a comment.May 4 2015, 12:26 AM

Still an issue in dev build 1.45.130581

ceeeb added a comment.Dec 5 2015, 4:47 AM

No change in 1.54

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?

ceeeb added a comment.Dec 6 2015, 10:54 PM

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.