void FixedUpdate() { base.DoMovement(); var launcherDist = (launcher.transform.position - transform.position).magnitude; if (!target.IsSet()) { Vis.Entities <BaseCombatEntity>(transform.position, 20, entList, 8192 | (1 << 11) | (1 << 17), QueryTriggerInteraction.Ignore); float best = -1.0f; BaseEntity bestTarget = null; foreach (var ent in entList) { if (ignoreSet.Contains(ent)) { continue; } var dir = ent.transform.position - transform.position; var dot = Vector3.Dot(_currentVelocity, dir); if (dot > best) { best = dot; bestTarget = ent; } //Print($"ent.name: {ent.name}"); } if (bestTarget && launcherDist > 5.0f) { target.Set(bestTarget); } } else { var hit = new RaycastHit(); hit.normal = Vector3.zero; SendMessage("ProjectileImpact", hit); Perforate(); } }