Combat/BulletTracer.cs
namespace Prototype;
/// <summary>Cosmetic travelling streak; damage still uses the shot's authoritative trace.</summary>
public sealed class BulletTracer : Component
{
public Vector3 Start { get; set; }
public Vector3 End { get; set; }
private float _age;
protected override void OnUpdate()
{
_age += Time.Delta;
var delta = End - Start;
var head = System.MathF.Min( delta.Length, _age * 14000f );
var tail = System.MathF.Max( 0, _age * 14000f - 160f );
if ( tail >= delta.Length ) { DestroyGameObject(); return; }
WorldPosition = Start + delta.Normal * ((head + tail) * .5f);
WorldScale = new Vector3( System.MathF.Max( 1, head - tail ), .65f, .65f );
}
}