-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
//abc_fnc_manualunflip={ | ||
//abc_fnc_manualunflip_hold={ | ||
_veh = objectParent player; | ||
private ["_VUP", "_cos"]; | ||
if (!isNull _veh && { //in veh | ||
_VUP = vectorUp _veh; | ||
_cos = _VUP vectorCos [0,0,1]; | ||
_cos <= cos ABS_minAngle && { //flipped | ||
abs (velocity _veh select 2) < 1 && { | ||
vectorMagnitude velocity _veh < 2 && { | ||
_veh isKindOf "CAR" || {_veh isKindOf "TANK" || {_veh isKindOf "MOTORCYCLE"}} | ||
} | ||
} | ||
}) then { | ||
params ["_xx", "_yy"]; | ||
_force = 2*getMass _veh*(1-_cos); | ||
_veh addTorque (_veh vectorModelToWorld [_force*_xx,_force*_yy,0]); | ||
(boundingBoxReal _veh) params ["_c1", "_c2", "_size"]; | ||
_c1 params ["_x1", "_y1", "_z1"]; | ||
_c2 params ["_x2", "_y2"]; | ||
_xc = (_x1 + _x2)/2; | ||
_yc = (_y1 + _y2)/2; | ||
_x = abs(_x1 - _x2)/2; | ||
_y = abs(_y1 - _y2)/2; | ||
|
||
_force = 0.5*(1-_cos)*getMass _veh*(1 - 0.65*abs _yy); | ||
_veh addForce [_veh vectorModelToWorld [0,0,-_force], [_xx*_x + _xc, _yy*_y + _yc, getCenterOfMass _veh select 2]]; | ||
}; | ||
//} |
16 changes: 12 additions & 4 deletions
16
addons/AntiBounceSystem/functions/fn_manualUnflip_Hold.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
//abc_fnc_manualunflip={ | ||
//abc_fnc_manualunflip_hold={ | ||
_veh = objectParent player; | ||
private ["_VUP", "_cos"]; | ||
if (!isNull _veh && { //in veh | ||
_VUP = vectorUp _veh; | ||
_cos = _VUP vectorCos [0,0,1]; | ||
_cos <= cos ABS_minAngle && { //flipped | ||
abs (velocity _veh select 2) < 1 && { | ||
vectorMagnitude velocity _veh < 2 && { | ||
_veh isKindOf "CAR" || {_veh isKindOf "TANK" || {_veh isKindOf "MOTORCYCLE"}} | ||
} | ||
} | ||
}) then { | ||
params ["_xx", "_yy"]; | ||
_force = 0.25*getMass _veh*(1-_cos); | ||
_veh addTorque (_veh vectorModelToWorld [_force*_xx,_force*_yy,0]); | ||
(boundingBoxReal _veh) params ["_c1", "_c2", "_size"]; | ||
_c1 params ["_x1", "_y1", "_z1"]; | ||
_c2 params ["_x2", "_y2"]; | ||
_xc = (_x1 + _x2)/2; | ||
_yc = (_y1 + _y2)/2; | ||
_x = abs(_x1 - _x2)/2; | ||
_y = abs(_y1 - _y2)/2; | ||
|
||
_force = 0.075*(1-_cos)*getMass _veh*(1 - 0.65*abs _yy); | ||
_veh addForce [_veh vectorModelToWorld [0,0,-_force], [_xx*_x + _xc, _yy*_y + _yc, getCenterOfMass _veh select 2]]; | ||
}; | ||
//} |