- Status
- Offline
- Joined
- Mar 3, 2026
- Messages
- 381
- Reaction score
- 7
Anyone who has spent time reversing Rust knows the projectile system isn't just about 'click and hit'. I've seen this specific code snippet circulating in several public bases and low-tier private builds, but it's fundamentally flawed for anything other than a target running straight at you.
The Logic in Question
The Problem with this Approach
This logic attempts to simulate drag by artificially reducing the BaseSpeed as the distance increases. While this might land headshots on a target moving linearly toward or away from you, it fails miserably when the target starts strafing or moving diagonally.
If you're seeing misses on diagonal movement, it's a sign your prediction doesn't account for the total flight time correctly. You're aiming where they were expected to be based on an incorrect speed value.
Anyone managed to refine these values or moved to a full physics-based solver for bows?
The Logic in Question
Code:
else if (WeaponName == xorstr_("bow.hunting") || WeaponName == xorstr_("legacy.bow"))
{
if (Distance <= 41.0f) BaseSpeed = 60.0f;
else if (Distance <= 82.0f) BaseSpeed = 58.0f;
else if (Distance <= 127.0f) BaseSpeed = 57.0f;
else if (Distance <= 255.0f) BaseSpeed = 52.1f;
else BaseSpeed = 50.0f;
}
The Problem with this Approach
This logic attempts to simulate drag by artificially reducing the BaseSpeed as the distance increases. While this might land headshots on a target moving linearly toward or away from you, it fails miserably when the target starts strafing or moving diagonally.
- No Gravity Compensation: This snippet only touches speed. Bows in Rust have a massive drop profile. If you aren't calculating the arc based on the projectile's gravity multiplier (usually around 0.75 for bows), you are just guessing height.
- Incorrect Travel Time: Prediction depends on TravelTime = Distance / AverageVelocity. By using these hardcoded steps, your travel time calculation is jerky and imprecise. Lateral movement requires a perfect sync between target velocity and the time it takes for that arrow to arrive.
- Drag is Continuous: In Rust, drag isn't stepped; it's a constant force. Using a 5-step IF-ELSE block is a very 'pasted' way of handling a physics-based engine.
To hit those long-range double headshots on a moving target, you need a proper iterative solver. Most decent external setups rely on a simplified ballistic trajectory. Remember that Projectile.drag and Projectile.gravityModifier are the values you should be pulling from the dump. For a hunting bow, the initial velocity is high, but the deceleration curve is steep. If you are missing lateral shots, your TargetVelocity vector projection is likely ignoring the projectile's deceleration over that specific distance.
If you're seeing misses on diagonal movement, it's a sign your prediction doesn't account for the total flight time correctly. You're aiming where they were expected to be based on an incorrect speed value.
Anyone managed to refine these values or moved to a full physics-based solver for bows?