33import com .hypixel .hytale .component .ComponentAccessor ;
44import com .hypixel .hytale .component .Ref ;
55import com .hypixel .hytale .math .vector .Vector3dUtil ;
6+ import com .hypixel .hytale .server .core .modules .debug .DebugUtils ;
67import com .hypixel .hytale .server .core .modules .entity .component .TransformComponent ;
78import com .hypixel .hytale .server .core .universe .world .storage .EntityStore ;
89import com .hypixel .hytale .server .npc .asset .builder .BuilderSupport ;
@@ -64,7 +65,7 @@ public void activate(
6465 this .startPosition = new Vector3d (selfTransform .getPosition ());
6566 this .targetPosition = new Vector3d (targetTransform .getPosition ());
6667 this .targetHorizontalDistance = Vector2d .distance (this .startPosition .x , this .startPosition .z , this .targetPosition .x , this .targetPosition .z );
67- this .peakHorizontalDistance = this .targetHorizontalDistance * Math .sqrt (Math .abs (this .arcHeight )) / (Math .sqrt (Math .abs (this .arcHeight )) + Math .sqrt (Math .abs (( this .targetPosition .y + this .arcHeight ) - this .startPosition .y )));
68+ this .peakHorizontalDistance = this .targetHorizontalDistance * Math .sqrt (Math .abs (this .arcHeight )) / (Math .sqrt (Math .abs (this .arcHeight )) + Math .sqrt (Math .abs (this .startPosition .y + this .arcHeight - this .targetPosition .y )));
6869 this .horizontalDirection = new Vector3d (this .targetPosition .x , 0 , this .targetPosition .z ).sub (this .startPosition .x , 0 , this .startPosition .z ).normalize ();
6970 this .t = 0 ;
7071
@@ -107,7 +108,7 @@ public boolean computeSteering(
107108 final double x1 = this .peakHorizontalDistance ;
108109 final double x2 = this .targetHorizontalDistance ;
109110 final double y0 = this .startPosition .y ;
110- final double y1 = y0 + this .arcHeight ;
111+ final double y1 = this . targetPosition . y + this .arcHeight ;
111112 final double y2 = this .targetPosition .y ;
112113 final double l0 = ((x - x1 ) * (x - x2 )) / ((x0 - x1 ) * (x0 - x2 ));
113114 final double l1 = ((x - x0 ) * (x - x2 )) / ((x1 - x0 ) * (x1 - x2 ));
@@ -127,6 +128,7 @@ public boolean computeSteering(
127128 desiredSteering .setTranslation (new Vector3d (difference ).normalize ());
128129 desiredSteering .setTranslationRelativeSpeed (speed );
129130 desiredSteering .setRelativeTurnSpeed (this .relativeTurnSpeed );
131+
130132 return true ;
131133 }
132134}
0 commit comments