Skip to content

Commit

Permalink
Semi-blind fix to force the proper branch. Likely a fix to #1197
Browse files Browse the repository at this point in the history
  • Loading branch information
lhog committed Feb 15, 2024
1 parent f203f17 commit d08065e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions rts/Sim/Weapons/Weapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,11 @@ float3 CWeapon::GetTargetBorderPos(
tmpColVol.SetBoundingRadius();
tmpColVol.SetUseContHitTest(false);

// the DetectHit() code below clearly indicates it should go
// CCollisionHandler::Collision() branch so force it explicitly
tmpColVol.SetDefaultToPieceTree(false);
tmpColVol.SetIgnoreHits(false);

// our weapon muzzle is inside the target unit's volume (FIXME: use aimFromPos?)
if (CCollisionHandler::DetectHit(targetUnit, &tmpColVol, targetUnit->GetTransformMatrix(true), weaponMuzzlePos, ZeroVector, nullptr))
return (targetBorderPos = weaponMuzzlePos);
Expand All @@ -843,6 +848,8 @@ float3 CWeapon::GetTargetBorderPos(
// this either increases or decreases the length of <targetVec> but does
// not change its direction
tmpColVol.SetUseContHitTest(true);
tmpColVol.SetDefaultToPieceTree(targetUnit->collisionVolume.DefaultToPieceTree());
tmpColVol.SetIgnoreHits(targetUnit->collisionVolume.IgnoreHits());

// make the ray-segment long enough so it can reach the far side of the
// scaled collision volume (helps to ensure a ray-intersection is found)
Expand Down

0 comments on commit d08065e

Please sign in to comment.