Page MenuHomeFeedback Tracker

Can't get WorldSpace coordinates of "eyeScope" and "cameraDir" selection of optic when attached to weapon
Closed, ResolvedPublic

Description

Getting WorldSpace coordinates of eyeScope and cameraDir selection of an optic while it is attached to a weapon doesn't give expected value.
It seems that only in certain condition (e.g. if the weapon is dropped) the coordinates are correct.

In the following videos, the yellow line represents the WorldSpace coordinates of eyeScope and cameraDir selection

In 1.13:

In 1.14:

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Operating System Version
21H2
Category
Scripting
Steps To Reproduce
// optic is type of ItemOptic
// got from the weapon in player hands with weapon.GetAttachedOptics()
vector eyeScopeLS   = optic.GetSelectionPositionLS( "eyeScope" );
vector cameraDirLS  = optic.GetSelectionPositionLS( "cameraDir" );		
vector eyeScopeWS  = optic.ModelToWorld( eyeScopeLS  );
vector cameraDirWS = optic.ModelToWorld( cameraDirLS  );

The code above works in 1.13:
Full code available here: github sGunplay

Additional Information

To avoid a possible floating point precision loss, especially when being far from the map origin (e.g. Svetloyarsk) I need to do the following

vector from = optic.GetSelectionPositionLS( "eyeScope" );
vector to   = optic.GetSelectionPositionLS( "cameraDir" );
m_lensPosition = optic.ModelToWorld(from + (vector.Direction(from, to) * distance));

otherwise the result wouldn't be accurate.

Note that the problem described in this task happens also when getting WorldSpace coordinates like this:

optic.GetSelectionPositionWS( "eyeScope" );

Event Timeline

simonvic created this task.Sep 5 2021, 11:47 PM
simonvic updated the task description. (Show Details)Sep 5 2021, 11:54 PM
MarioE added a subscriber: MarioE.Sep 6 2021, 10:10 AM
Geez edited projects, added DayZ Modding; removed DayZ.Sep 6 2021, 5:08 PM
Geez changed the task status from New to Assigned.
Geez closed this task as Resolved.Sep 22 2021, 9:55 AM
Geez claimed this task.
Geez added a subscriber: Geez.

Hello simonvic.
This issue will be resolved in the upcoming 1.14 update.
Regards,
Geez

Awesome, thanks!