SteamWar/BauSystem2.0
Archiviert
12
0

fix(tracer): Fixed first point of advanced flag incorrect calc order #254

Zusammengeführt
Lixfel hat 1 Commits von fix-tracer-advanced-flag-first-tick-calc nach master 2024-07-06 18:49:00 +02:00 zusammengeführt
Nur Änderungen aus Commit a62c08b097 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -34,6 +34,9 @@ import java.util.stream.Stream;
* A settable flag that changes how a trace is rendered * A settable flag that changes how a trace is rendered
*/ */
public abstract class ViewFlag { public abstract class ViewFlag {
public static final Vector GRAVATY = new Vector(0.0, -0.04, 0.0);
public static final Vector DRAG_FACTOR = new Vector(0.98, 0.98, 0.98);
/** /**
* Static registry of static flags * Static registry of static flags
*/ */
@ -122,9 +125,8 @@ public abstract class ViewFlag {
if (prev.isEmpty()) continue; if (prev.isEmpty()) continue;
TNTPoint previous = prev.get(); TNTPoint previous = prev.get();
Vector previousVelocity = previous.getVelocity();
Location delta = representative.getLocation().clone().subtract(previous.getLocation()); Location delta = representative.getLocation().clone().subtract(previous.getLocation());
Vector previousVelocity = previous.isAfterFirstExplosion() ? previous.getVelocity() : delta.toVector().clone().divide(DRAG_FACTOR).subtract(GRAVATY);
Location yLocation = previous.getLocation().clone().add(0, delta.getY(), 0); Location yLocation = previous.getLocation().clone().add(0, delta.getY(), 0);
if (yLocation.distanceSquared(representative.getLocation()) >= 1.0 / 256.0 && yLocation.distanceSquared(previous.getLocation()) >= 1.0 / 256.0) { if (yLocation.distanceSquared(representative.getLocation()) >= 1.0 / 256.0 && yLocation.distanceSquared(previous.getLocation()) >= 1.0 / 256.0) {