Something like this should work
keep in mind this doesn’t account for changes in height that’s a whole different can of worms
but if point a to point b is flat, this should do the trick so long as the spawners local x is facing the direction you want whatever you’re moving to go
i used a creative prop here but so long as whatever you’re moving has access to stuff like GetTransform() you should be good to go
Edit : let me know if there are syntax errors ( I typed this out on the website )
@editable Spawner : player_spawner_device = player_spawner_device{}
@editable Prop : creative_prop = creative_prop{}
Magnitude(vector:vector3):float=
return Sqrt(Pow(vector.X, 2.0) + Pow(vector.Y, 2.0) + Pow(vector.Z, 2.0))
Normalize(vector:vector3):vector3=
Mag := Magnitude(vector)
return vector3{X := vector.X/Mag, Y := vector.Y/Mag, Z:= vector.Z/Mag}
Move_NPC(prop:creative_prop, spawner:player_spawner_device)<suspends>:void= #just used a creative prop here as an example you can pass in whatever you want
prop_loc := prop.GetTransform().Translation
spawner_loc := spawner.GetTransform().Translation
spawner_rot := spawner.GetTransform().Rotation
spawner_yaw_pitch_roll := spawner_rot.GetYawPitchRollDegrees()
Move_Time := 15.0
if(NewYaw := spawner_yaw_pitch_roll[0] - 90.0):
if(Corrected_Spawner_Rot := MakeRotationFromYawPitchRollDegrees(NewYaw, spawner_yaw_pitch_roll[1], spawner_yaw_pitch_roll[2])):
Spawner_Local_Forward := Corrected_Spawner_Rot.GetLocalForward()
Normalized_Forward_Vector := Normalize(Spawner_Local_Forward)
Dist := 24000.0
Target_Location : vector3 = vector3:
X := prop_loc.X + (Normalized_Forward_Vector.X * Dist)
Y := prop_loc.Y + (Normalized_Forward_Vector.Y * Dist)
Z := prop_loc.Z
prop.MoveTo(Target_Location, spawner_rot, Move_Time)