Skip to content

Drone static weapon targeting line-of-sight issue with terrain #286

Open

Description

@adrsquared

For drones that target players (or grids) that are low to the ground with static guns, they are unable to fire consistently because they are detecting the ground as an obstacle. They appear to be checking line of sight with "collision.HasTarget(maxTargetTrajectory + 50)" in BaseWeapon.cs, which results in the ground beneath the player/grid being picked up as an obstacle, even if it's behind/below the target.

Activity

  1. adrsquared commented on Nov 29, 2023

    @adrsquared
    Author

    Tested more with grid targets, and it seems to happen less since the raycast will hit the grid when aiming dead-on and not register the ground as an obstacle. If it's even a little off, though, even when still within the allowed angle range, the guns will stop. It happens most consistently with the Player as a target. Both Fighter and HorseFighter behavior types have the same issue.

  2. adrsquared commented on Mar 2, 2025

    @adrsquared
    Author

    From what I can see this is a one-line fix in BaseWeapon.cs: ln 222.
    //if ((collision.Type == CollisionType.Voxel && !collision.CollisionIsWater) || collision.Type == CollisionType.Safezone) {
    if ((collision.Type == CollisionType.Voxel && !collision.CollisionIsWater && collision.HasTarget(maxTargetTrajectory - 5)) || collision.Type == CollisionType.Safezone) {

    The obstacle check goes beyond the target to make sure that there are no friendly grids behind its current target to reduce friendly fire, but it treats voxels behind the target as a reason to stop firing as well. This tweak adds a second check if the nearest collision is a voxel type to make sure the voxels are actually obstructing.

  3. added
    Bug ReportedThis label indicates that a bug has been reported but not yet confirmed.
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug ReportedThis label indicates that a bug has been reported but not yet confirmed.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions