diff --git a/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf b/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf index 1a7da556..ba07f88d 100644 --- a/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf +++ b/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf @@ -24,9 +24,20 @@ if (EPOCH_velTransform) then { EPOCH_target setvelocitytransformation[_pos1, (EP_velocityTransformation select 0), _vel1, (EP_velocityTransformation select 1), _dir1, (EP_velocityTransformation select 2), _up1, (EP_velocityTransformation select 3), _interval]; } else { _pos2 = player modelToWorld[EPOCH_X_OFFSET, EPOCH_Y_OFFSET, EPOCH_Z_OFFSET]; + _CfgEpochClient = 'CfgEpochClient' call EPOCH_returnConfig; + _maxBuildingHeight = getNumber(_CfgEpochClient >> "maxBuildingHeight"); + if !(_maxBuildingHeight == 0) then { + if (_pos2 select 2 > _maxBuildingHeight) then { + _pos2 set[2, _maxBuildingHeight]; + }; + }; if ((_pos2 select 2) < 0) then { _pos2 set[2, 0] }; if ((_pos1 distance _pos2) > 0) then { - EPOCH_target setvelocitytransformation[_pos1, AGLtoASL _pos2, _vel1, _vel1, _dir1, _dir1, _up1, _up1, _interval]; + _newpos = AGLtoASL _pos2; + if (surfaceiswater _pos2) then { + _newpos = _pos2; + }; + EPOCH_target setvelocitytransformation[_pos1, _newpos, _vel1, _vel1, _dir1, _dir1, _up1, _up1, _interval]; }; }; } else {