Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix attach offsets not being relative to the object's center #663

Merged
merged 4 commits into from
Feb 25, 2022

Conversation

RedFoxIV
Copy link
Contributor

private _offset = _object worldToModel ASLtoAGL getPosASL _x;

At this line worldToModel ASLtoAGL getPosASL is used to get the offset required for correct attachment of _x.
The problem is, the resulting coordinate is not relative to the center of the _object, but it's base. (This may be more complicated if the object is tilted, but it's still not the center.) As a result, _x is displaced vertically.

I have tested the following method for every degree of rotation along the global X axis, from 0 to 359. It seems to be a lot more accurate without any special olympics tier of crutches to negate the error in the offset.

_object WorldToModel ASLToAGL getPosWorld _x

Related issue - #649

@mharis001
Copy link
Member

Please remove the shortcut file as well.

@mharis001 mharis001 added the bug fix Fixes a bug label Feb 24, 2022
@mharis001 mharis001 added this to the 1.13.0 milestone Feb 24, 2022
RedFoxIV and others added 2 commits February 24, 2022 14:39
Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>
@RedFoxIV
Copy link
Contributor Author

Done

@Kexanone
Copy link
Member

Well spotted, but needs to be fixed for exported SQF as well:

private _offset = _object worldToModel ASLtoAGL getPosASL _x;

@mharis001 mharis001 changed the title Attached objects in compositions are no longer displaced Fix attach offsets not being relative to the object's center Feb 25, 2022
@mharis001 mharis001 merged commit 5143dc2 into zen-mod:master Feb 25, 2022
@mharis001 mharis001 modified the milestones: 1.13.0, 1.12.2 Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants