I am trying to move a model to a waypoint (pathfinding) via LERPing however I’ve come across numerous issues:
I am not able to LERP via CFrame as the waypoint does not have a CFrame, only a Vector3 value.
I’ve welded everything together but the model just falls flat without moving no matter what.
I don’t know any other method to make it move besides using LERP.
I’ve looked on the DevForum and other sites and I am unable to find posts even talking about using pathfinding on objects that don’t have a humanoid.
Code:
local pathfindingservice = game:GetService("PathfindingService")
local Manhack = game.Workspace:WaitForChild("Manhack")
local path = pathfindingservice:CreatePath()
path:ComputeAsync(Manhack.Engine.Position, workspace.Part.Position)
local waypoints = path:GetWaypoints()
Manhack.PrimaryPart = Manhack.Engine
for i, waypoint in pairs(waypoints) do
local part = Instance.new("Part")
part.Position = waypoint.Position
part.Size = Vector3.new(0.6,0.6,0.6)
part.Shape = "Ball"
part.Anchored = true
part.CanCollide = false
part.Parent = workspace
for i = 0, 100, 2 do
Manhack.Engine.Position = Manhack.Engine.Position:Lerp(waypoint.Position, i/100) -- I tried with and without dividing by 100, neither made a difference.
end
end
Also tell me if there are easier and more efficient ways of doing this.
I just created a new pathfinding open sourced module. It is easier to use than the normal roblox pathfinding system, but I don’t know if it will fix the moving problem. If you want to try it, you can view my thread here:
Could you not just create a new CFrame value to lerp to? You could create a new CFrame like this: CFrame.new(Position.X, Position.Y, Position.Z).
If I remember my older welds correctly setting a parts position will just move that part and no parts attached.
I see, it… works? It instantly teleports there and putting a wait, no matter the duration, just makes it take very long to move to the next waypoint though you’ve all helped a lot so I think I’ll tackle this alone. Thanks for the help.
Just adding this just in case, but make sure you don’t have any empty loops because they do actually take up time, so if you know a loop should be finished, remember to add a break in there.
Maybe try using my pathfinding system, you can easily change the npc’s walkspeed, it goes up stairs, you can change the params, make it jump, change the jumppower, pause and play it.
I mean if we were to go with easier, the original pathfinding system would be easiest, and that was not criticism, I’m sure your system is great, but he already made it clear he doesn’t want to use other people’s work in his own system.