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 3D rotations for Attach To module #658

Merged
merged 4 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@
_object setVectorUp _vectorUp;
}] call CBA_fnc_addEventHandler;

[QGVAR(setVectorDirAndUp), {
params ["_object", "_dirAndUp"];
_object setVectorDirAndUp _dirAndUp;
}] call CBA_fnc_addEventHandler;

[QGVAR(setVelocity), {
params ["_object", "_velocity"];
_object setVelocity _velocity;
Expand Down
4 changes: 2 additions & 2 deletions addons/modules/functions/fnc_moduleAttachTo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ if (!isNull attachedTo _object) exitWith {
[LSTRING(CannotAttachToSelf)] call EFUNC(common,showMessage);
};

private _direction = getDir _object - getDir _entity;
private _dirAndUp = [_entity vectorWorldToModel vectorDir _object, _entity vectorWorldToModel vectorUp _object];

_object attachTo [_entity];
[QEGVAR(common,setDir), [_object, _direction], _object] call CBA_fnc_targetEvent;
[QEGVAR(common,setVectorDirAndUp), [_object, _dirAndUp], _object] call CBA_fnc_targetEvent;

[LSTRING(ObjectAttached)] call EFUNC(common,showMessage);
}, [], LSTRING(ModuleAttachTo)] call EFUNC(common,selectPosition);