You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Drone static weapon targeting line-of-sight issue with terrain #286
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.
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.
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.
Activity
adrsquared commentedon Nov 29, 2023
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.
adrsquared commentedon Mar 2, 2025
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.