Skip to content

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

Merged
mharis001 merged 4 commits intozen-mod:masterfrom
RedFoxIV:master
Feb 25, 2022
Merged

Fix attach offsets not being relative to the object's center#663
mharis001 merged 4 commits intozen-mod:masterfrom
RedFoxIV:master

Conversation

@RedFoxIV
Copy link
Copy Markdown
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

Comment thread addons/common/functions/fnc_serializeObjects.sqf Outdated
@mharis001
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Done

@Kexanone
Copy link
Copy Markdown
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