Guided projectile: only the simulation's detonation shows an explosion
The overshoot branch of GuidedProjectile.Update (out of range, or flown past its target) instantiated HitEffect whatever the simulation had decided. A round the simulation never detonated could therefore explode on screen. The branch now fades the round out; Resolve stays the one place a HitEffect is shown for a detonation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7e620ff9f2
commit
63a2fcdaa4
1 changed files with 2 additions and 5 deletions
|
|
@ -134,14 +134,11 @@ public class GuidedProjectile : MonoBehaviour
|
|||
var targetDist = diff.magnitude;
|
||||
var sourceDist = length(StartPosition.xz - position.xz);
|
||||
|
||||
// Out of range, or flown past its target: the round falls away. Only the simulation's detonation
|
||||
// (Resolve) shows an explosion; a round that merely ran out of flight has none.
|
||||
if (sourceDist > Range || dot(diff.ToCultMath(), Velocity.ToCultMath()) < 0)
|
||||
{
|
||||
StartCoroutine(FadeOut());
|
||||
if (HitEffect != null)
|
||||
{
|
||||
var ht = HitEffect.Instantiate<Transform>();
|
||||
ht.position = t.position;
|
||||
}
|
||||
return;
|
||||
}
|
||||
_prevDist = targetDist;
|
||||
|
|
|
|||
Loading…
Reference in a new issue