Switch everything to use modelToWorldVisual instead of modelToWorld.

This commit is contained in:
Nou 2015-04-03 15:26:27 -07:00
parent 6c4dda2dc8
commit 6541600d44
24 changed files with 35 additions and 33 deletions

View File

@ -94,7 +94,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
_unit removeAction _actionID; _unit removeAction _actionID;
if (GVAR(placeAction) == 1) then { if (GVAR(placeAction) == 1) then {
_startingPosition = _tempObject modelToWorld [0,0,0]; _startingPosition = _tempObject modelToWorldVisual [0,0,0];
[_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAtachText, _startingPosition] call FUNC(placeApprove); [_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAtachText, _startingPosition] call FUNC(placeApprove);
}; };
deleteVehicle _tempObject; deleteVehicle _tempObject;

View File

@ -25,6 +25,6 @@ _itemName = [_args, 0, ""] call CBA_fnc_defaultParam;
_attachLimit = [6, 1] select (_player == _attachToVehicle); _attachLimit = [6, 1] select (_player == _attachToVehicle);
_attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []]; _attachedObjects = _attachToVehicle getVariable [QGVAR(Objects), []];
_playerPos = (ACE_player modelToWorld (ACE_player selectionPosition "pilot")); _playerPos = (ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"));
(canStand _player) && {(_attachToVehicle distance _player) < 7} && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_itemName in ((itemsWithMagazines _player) + [""])}; (canStand _player) && {(_attachToVehicle distance _player) < 7} && {alive _attachToVehicle} && {(count _attachedObjects) < _attachLimit} && {_itemName in ((itemsWithMagazines _player) + [""])};

View File

@ -45,7 +45,7 @@ while {(_closeInMax - _closeInMin) > 0.01} do {
// systemChat format ["Trying %1 from %2 start %3", _closeInDistance, [_closeInMax, _closeInMin], _startDistanceFromCenter]; // systemChat format ["Trying %1 from %2 start %3", _closeInDistance, [_closeInMax, _closeInMin], _startDistanceFromCenter];
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
_endPosTestOffset set [2, (_startingOffset select 2)]; _endPosTestOffset set [2, (_startingOffset select 2)];
_endPosTest = _attachToVehicle modelToWorld _endPosTestOffset; _endPosTest = _attachToVehicle modelToWorldVisual _endPosTestOffset;
_doesIntersect = false; _doesIntersect = false;
{ {

View File

@ -37,7 +37,7 @@ _sounds = [
QUOTE(PATHTO_R(sounds\zip_out.wav)) QUOTE(PATHTO_R(sounds\zip_out.wav))
]; ];
_position = _target modelToWorld (_target selectionPosition "Spine3"); _position = _target modelToWorldVisual (_target selectionPosition "Spine3");
_position = _position call EFUNC(common,positionToASL); _position = _position call EFUNC(common,positionToASL);
playSound3D [ playSound3D [

View File

@ -57,7 +57,7 @@ switch ((_type select 0)) do {
}; };
} else { } else {
_addedToPlayer = false; _addedToPlayer = false;
_pos = _unit modelToWorld [0,1,0.05]; _pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"]; _unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
_unit addWeaponCargoGlobal [_classname,1]; _unit addWeaponCargoGlobal [_classname,1];
_unit setPosATL _pos; _unit setPosATL _pos;
@ -73,7 +73,7 @@ switch ((_type select 0)) do {
}; };
} else { } else {
_addedToPlayer = false; _addedToPlayer = false;
_pos = _unit modelToWorld [0,1,0.05]; _pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"]; _unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
_unit addMagazineCargoGlobal [_classname, 1]; _unit addMagazineCargoGlobal [_classname, 1];
_unit setPosATL _pos; _unit setPosATL _pos;
@ -89,7 +89,7 @@ switch ((_type select 0)) do {
}; };
} else { } else {
_addedToPlayer = false; _addedToPlayer = false;
_pos = _unit modelToWorld [0,1,0.05]; _pos = _unit modelToWorldVisual [0,1,0.05];
_unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"]; _unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
_unit addItemCargoGlobal [_classname,1]; _unit addItemCargoGlobal [_classname,1];
_unit setPosATL _pos; _unit setPosATL _pos;

View File

@ -242,10 +242,10 @@ _fnc_isInRange = {
private ["_unitPosition", "_distance"]; private ["_unitPosition", "_distance"];
_unitPosition = getPos _unit; _unitPosition = getPos _unit;
_distance = _unitPosition distance (_vehicle modelToWorld _selectionPosition); _distance = _unitPosition distance (_vehicle modelToWorldVisual _selectionPosition);
if (!isNil "_selectionPosition2") then { if (!isNil "_selectionPosition2") then {
_distance = _distance min (_unitPosition distance (_vehicle modelToWorld _selectionPosition2)); _distance = _distance min (_unitPosition distance (_vehicle modelToWorldVisual _selectionPosition2));
}; };
_distance < _radius _distance < _radius

View File

@ -27,11 +27,11 @@ _povDir = [0,0,0];
if(_pov == "pip0_pos") then { if(_pov == "pip0_pos") then {
_pipDir = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir" ) ); _pipDir = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir" ) );
_povDir = _povPos vectorDiff _pipDir; _povDir = _pipDir vectorDiff _povPos;
} else { } else {
_gunBeginPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg ) ); _gunBeginPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg ) );
_gunEndPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd ) ); _gunEndPos = ATLtoASL ( _vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd ) );
_povDir = _gunEndPos vectorDiff _gunBeginPos; _povDir = _gunBeginPos vectorDiff _gunEndPos;
}; };
[_povPos, _povDir] [_povPos, _povDir]

View File

@ -14,7 +14,7 @@ private ["_unit","_return","_aslPos"];
_unit = _this select 0; _unit = _this select 0;
_return = false; _return = false;
if ((surfaceIsWater getPos _unit)) then { if ((surfaceIsWater getPos _unit)) then {
_aslPos = _unit modelToWorld (_unit selectionPosition "head"); _aslPos = _unit modelToWorldVisual (_unit selectionPosition "head");
if ((_aslPos select 2) <= 0) then { if ((_aslPos select 2) <= 0) then {
_return = true; _return = true;
}; };

View File

@ -36,7 +36,7 @@ if (_target isKindOf "CAManBase") then {
// add height offset of model // add height offset of model
private "_offset"; private "_offset";
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2); _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2);
_position = _position vectorAdd [0, 0, _offset]; _position = _position vectorAdd [0, 0, _offset];

View File

@ -25,7 +25,7 @@ _direction = _target getVariable [QGVAR(dragDirection), 0];
// add height offset of model // add height offset of model
private "_offset"; private "_offset";
_offset = (_target modelToWorld [0, 0, 0] select 2) - (_unit modelToWorld [0, 0, 0] select 2); _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2);
_position = _position vectorAdd [0, 0, _offset]; _position = _position vectorAdd [0, 0, _offset];

View File

@ -36,7 +36,7 @@ if (_carriedItem isKindOf "CAManBase") exitWith {false};
private ["_position", "_maxHeight"]; private ["_position", "_maxHeight"];
_position = getPosATL _carriedItem; _position = getPosATL _carriedItem;
_maxHeight = (_unit ModelToWorld [0,0,0]) select 2; _maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2;
_position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight]; _position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight];

View File

@ -19,7 +19,7 @@
#include "script_component.hpp" #include "script_component.hpp"
EXPLODE_4_PVT(_this select 0,_unit,_i,_arr,_code); EXPLODE_4_PVT(_this select 0,_unit,_i,_arr,_code);
if ((_i mod 4) == 0) then { if ((_i mod 4) == 0) then {
playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit ModelToWorld [0,0.2,2]), 15,1,2.5]; playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit modelToWorldVisual [0,0.2,2]), 15,1,2.5];
}; };
ctrlSetText [1400,format["Calling%1",_arr select (_i - 4)]]; ctrlSetText [1400,format["Calling%1",_arr select (_i - 4)]];

View File

@ -15,7 +15,7 @@
* Placed explosive <OBJECT> * Placed explosive <OBJECT>
* *
* Example: * Example:
* _explosive = [player, player modelToWorld [0,0.5, 0.1], 134, * _explosive = [player, player modelToWorldVisual [0,0.5, 0.1], 134,
* "SatchelCharge_Remote_Mag", "Command", []] call ACE_Explosives_fnc_placeExplosive; * "SatchelCharge_Remote_Mag", "Command", []] call ACE_Explosives_fnc_placeExplosive;
* *
* Public: Yes * Public: Yes

View File

@ -28,15 +28,15 @@ if((count _this) > 2) then {
_pos = _this select 2; _pos = _this select 2;
} else { } else {
if(typeName (_actionData select 7) == "ARRAY") then { if(typeName (_actionData select 7) == "ARRAY") then {
_pos = _object modelToWorld (_actionData select 7); _pos = _object modelToWorldVisual (_actionData select 7);
} else { } else {
if ((_actionData select 7) == "weapon") then { if ((_actionData select 7) == "weapon") then {
// Craft a suitable position for weapon interaction // Craft a suitable position for weapon interaction
_weaponDir = _object weaponDirection currentWeapon _object; _weaponDir = _object weaponDirection currentWeapon _object;
_ref = _weaponDir call EFUNC(common,createOrthonormalReference); _ref = _weaponDir call EFUNC(common,createOrthonormalReference);
_pos = (_object modelToWorld (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1); _pos = (_object modelToWorldVisual (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1);
} else { } else {
_pos = _object modelToWorld (_object selectionPosition (_actionData select 7)); _pos = _object modelToWorldVisual (_object selectionPosition (_actionData select 7));
}; };
}; };
// Compensate for movement during the frame to get rid of jittering // Compensate for movement during the frame to get rid of jittering
@ -45,7 +45,7 @@ if((count _this) > 2) then {
// For non-self actions, exit if the action is too far away // For non-self actions, exit if the action is too far away
if (GVAR(openedMenuType) == 0 && vehicle ACE_player == ACE_player && if (GVAR(openedMenuType) == 0 && vehicle ACE_player == ACE_player &&
{(ACE_player modelToWorld (ACE_player selectionPosition "pilot")) distance _pos >= _distance}) exitWith {false}; {(ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot")) distance _pos >= _distance}) exitWith {false};
// Exit if the action is behind you // Exit if the action is behind you
_sPos = if (count _pos != 2) then { _sPos = if (count _pos != 2) then {

View File

@ -19,7 +19,7 @@ if(!(isNil "ACE_LASERS")) then {
{ {
if(!(isNull _x)) then { if(!(isNull _x)) then {
_sensorPos = ATLtoASL(_missile modelToWorld _offset); _sensorPos = ATLtoASL(_missile modelToWorldVisual _offset);
_vectorTo = [_sensorPos, ([_x] call FUNC(getPosASL))] call BIS_fnc_vectorFromXToY; _vectorTo = [_sensorPos, ([_x] call FUNC(getPosASL))] call BIS_fnc_vectorFromXToY;
_polarTo = _vectorTo call CBA_fnc_vect2polar; _polarTo = _vectorTo call CBA_fnc_vect2polar;
_dir = _polarTo select 1; _dir = _polarTo select 1;

View File

@ -1,4 +1,4 @@
//#define DEBUG_MODE_FULL // #define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
TRACE_1("enter", _this); TRACE_1("enter", _this);
@ -47,6 +47,8 @@ FUNC(laserHudDesignatePFH) = {
_povPos = _turretInfo select 0; _povPos = _turretInfo select 0;
_povDir = _turretInfo select 1; _povDir = _turretInfo select 1;
_result = [_povPos, _povDir] call EFUNC(laser,shootCone); _result = [_povPos, _povDir] call EFUNC(laser,shootCone);
if((count _result) > 0) then { if((count _result) > 0) then {
_resultPositions = _result select 2; _resultPositions = _result select 2;
@ -81,7 +83,7 @@ FUNC(laserHudDesignatePFH) = {
{ {
private["_position"]; private["_position"];
_position = _x select 0; _position = _x select 0;
drawLine3d [_povPos, _position, [0,0,1,1] ]; drawLine3d [ASLToATL _povPos, ASLToATL _position, [0,0,1,1] ];
} forEach _resultPositions; } forEach _resultPositions;
#endif #endif
}; };

View File

@ -3,7 +3,7 @@
EXPLODE_3_PVT(_this,_unit,_range,_isGreen); EXPLODE_3_PVT(_this,_unit,_range,_isGreen);
_p0Pos = _unit modelToWorld (_unit selectionPosition "righthand"); _p0Pos = _unit modelToWorldVisual (_unit selectionPosition "righthand");
// Convert _p0Pos to ASL // Convert _p0Pos to ASL
_p0 = + _p0Pos; _p0 = + _p0Pos;

View File

@ -37,7 +37,7 @@ _medicalFacility =
"USMC_WarfareBFieldhHospital" "USMC_WarfareBFieldhHospital"
]; ];
_objects = (lineIntersectsWith [_unit modelToWorld [0, 0, (_eyePos select 2)], _unit modelToWorld [0, 0, (_eyePos select 2) +10], _unit]); _objects = (lineIntersectsWith [_unit modelToWorldVisual [0, 0, (_eyePos select 2)], _unit modelToWorldVisual [0, 0, (_eyePos select 2) +10], _unit]);
{ {
if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith { if (((typeOf _x) in _medicalFacility) || (_x getVariable [QGVAR(isMedicalFacility),false])) exitwith {
_isInBuilding = true; _isInBuilding = true;

View File

@ -83,7 +83,7 @@ FUNC(guidance_DIRECT_LOAL_PFH) = {
if(accTime > 0) then { if(accTime > 0) then {
_outVector = [_dagr, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); _outVector = [_dagr, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace);
// _outVector = _dagr modelToWorld [_yaw, 1, _pitch]; // _outVector = _dagr modelToWorldVisual [_yaw, 1, _pitch];
// _outVector = ATLtoASL _outVector; // _outVector = ATLtoASL _outVector;
_vectorTo = _dagrPos vectorFromTo _outVector; _vectorTo = _dagrPos vectorFromTo _outVector;

View File

@ -73,7 +73,7 @@ FUNC(guidance_LGB_LOAL_PFH) = {
if(accTime > 0) then { if(accTime > 0) then {
_outVector = [_lgb, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace); _outVector = [_lgb, [_xVec, _yVec, _zVec], [_yaw, 1/accTime, _pitch]] call FUNC(translateToModelSpace);
// _outVector = _lgb modelToWorld [_yaw, 1, _pitch]; // _outVector = _lgb modelToWorldVisual [_yaw, 1, _pitch];
// _outVector = ATLtoASL _outVector; // _outVector = ATLtoASL _outVector;
_vectorTo = _lgbPos vectorFromTo _outVector; _vectorTo = _lgbPos vectorFromTo _outVector;

View File

@ -21,7 +21,7 @@ private ["_unit", "_anim", "_pos"];
_unit = _this select 0; _unit = _this select 0;
_anim = _this select 1; _anim = _this select 1;
_pos = _unit modelToWorld (_unit selectionPosition "camera"); _pos = _unit modelToWorldVisual (_unit selectionPosition "camera");
[_unit, "AmovPknlMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); [_unit, "AmovPknlMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation);
_pos = _pos vectorDiff (_unit selectionPosition "camera"); _pos = _pos vectorDiff (_unit selectionPosition "camera");

View File

@ -18,7 +18,7 @@ EXPLODE_3_PVT(_this,_unit,_vehicle,_weapon);
private ["_weaponPos", "_weaponDir", "_weaponPosDown"]; private ["_weaponPos", "_weaponDir", "_weaponPosDown"];
_weaponPos = ATLtoASL (_unit modelToWorld (_unit selectionPosition "RightHand")); _weaponPos = ATLtoASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand"));
_weaponDir = _unit weaponDirection _weapon; _weaponDir = _unit weaponDirection _weapon;
_weaponPosDown = _weaponPos vectorAdd [0,0,-MAXHEIGHT]; _weaponPosDown = _weaponPos vectorAdd [0,0,-MAXHEIGHT];

View File

@ -26,7 +26,7 @@ if (count _sound < 3) then {_sound pushBack 1};
if (count _sound < 4) then {_sound pushBack 0}; if (count _sound < 4) then {_sound pushBack 0};
private "_position"; private "_position";
_position = _unit modelToWorld (_unit selectionPosition "RightHand"); _position = _unit modelToWorldVisual (_unit selectionPosition "RightHand");
_position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)]; _position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)];
playSound3D [_sound select 0, objNull, false, _position, _sound select 1, _sound select 2, _sound select 3]; playSound3D [_sound select 0, objNull, false, _position, _sound select 1, _sound select 2, _sound select 3];

View File

@ -27,7 +27,7 @@ if (count _sound < 4) then {_sound pushBack 0};
private "_position"; private "_position";
_position = _unit modelToWorld (_unit selectionPosition "RightHand"); _position = _unit modelToWorldVisual (_unit selectionPosition "RightHand");
_position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)]; _position set [2, (_position select 2) + ((getPosASLW _unit select 2) - (getPosATL _unit select 2) max 0)];
playSound3D [_sound select 0, objNull, false, _position, _sound select 1, _sound select 2, _sound select 3]; playSound3D [_sound select 0, objNull, false, _position, _sound select 1, _sound select 2, _sound select 3];