Hello, I was wondering how I could get rid of this weird orientation bug for the first few rotations between these waypoints. Basically I have a for waypoint = 1, #waypoints:GetChildren() do loops that tween the NPC to the next waypoint and set the orientation to the waypoints lookvector. But the problem is that if I wanted to tween the orientation to smoothly look at the new waypoint then the NPC flips suddenly to be on the correct axis. Making it do what is in the video. It seems to work a little bit better if I get rid of all Orientation on the waypoint parts but that is kind of tedious to do it for say 20 waypoints in a big map. ( CFrame -> Orientation -> Vector3(0, 0, 0) ). Is there any other solution to this issue?
for waypoint = 1, #waypoints:GetChildren() do
local Distance = (hrp.Position - waypoints[waypoint].Position).Magnitude
local cframeLookat = CFrame.lookAt(hrp.Position, Vector3.new(waypoints[waypoint].Position.X, hrp.Position.Y, waypoints[waypoint].Position.Z))
local rx, ry, rz = cframeLookat:ToOrientation()
local dx, dy, dz = math.deg(rx), math.deg(ry), math.deg(rz)
local orientation = Vector3.new(dx, dy, dz)
local moveTween = TweenService:Create(hrp, TweenInfo.new(GetTime(Distance, script.Parent:FindFirstChild("WalkSpeed").Value), Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {Position = waypoints[waypoint].Position})
hrp.Orientation = orientation
-- The old code used to Tween the orientation | TweenService:Create(hrp, TweenInfo.new(0.25, Enum.EasingStyle.Exponential), {Orientation = orientation}):Play()
moveTween:Play()
moveTween.Completed:Wait()
end
TL;DR I want the NPC’s orientation to be like the last 2 seconds of the video while doing that smoothly.
What do you mean bezier curves? Do you have an idea of how I could implement them? Is that how TDS has a zombie system where they spawn at differently positioned waypoints and stay that way?