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

Artillerytables - Fix Low shots & bad params #10325

Merged
merged 3 commits into from
Sep 20, 2024
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
2 changes: 1 addition & 1 deletion addons/artillerytables/functions/fnc_adjustFire.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ params ["_gunPos", "_targetPos", "_adjustEast", "_adjustNorth", "_adjustUp", "_m

private _resultPos = [_adjustEast + _targetPos select 0, _adjustNorth + _targetPos select 1, _adjustUp + _targetPos select 2];

private _returns = ["_gunPos", "_resultPos", "_muzzleVelocity", "_highAngle", "_airFriction", "_temperature", "_airDensity", "_windDir", "_windSpeed"] call FUNC(calculateSolution);
private _returns = [_gunPos, _resultPos, _muzzleVelocity, _highAngle, _airFriction, _temperature, _airDensity, _windDir, _windSpeed] call FUNC(calculateSolution);

_returns
7 changes: 6 additions & 1 deletion extension/src/artillery/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ pub fn find_solution(
return (-1.0, -1.0, -1.0);
}
let radicand = radicand.sqrt();
let angle_root =
let mut angle_root =
(muzzle_velocity.mul_add(*muzzle_velocity, radicand) / (GRAVITY * range_to_hit)).atan();
if angle_root > max_elev || angle_root < min_elev {
angle_root = (muzzle_velocity.mul_add(*muzzle_velocity, -radicand)
/ (GRAVITY * range_to_hit))
.atan();
}
if angle_root > max_elev || angle_root < min_elev {
return (-1.0, -1.0, -1.0);
}
Expand Down
Loading