Pathfinding with non-humanoid parts

I am trying to move a model to a waypoint (pathfinding) via LERPing however I’ve come across numerous issues:

  1. I am not able to LERP via CFrame as the waypoint does not have a CFrame, only a Vector3 value.
  2. I’ve welded everything together but the model just falls flat without moving no matter what.
  3. 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.

1 Like

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:

1 Like

You can use lerp on part, it has a CFrame, its just not showed in properties

If its model, use :SetPrimaryPartCFrame()

1 Like

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.

1 Like

You don’t even need to do it like that, you can just use a whole vector3 as an argument to make a CFrame.

1 Like

The waypoint doesn’t have a CFrame, I had originally wrote:

Manhack.Engine.CFrame = Manhack.Engine.CFrame:Lerp(waypoint.CFrame, i/100)

And it gave an error since the waypoint didn’t have a CFrame, only a Vector3 value.

What type of error? 30 charsssss

Wait, so what are you moving then? Every part has a CFrame

1 Like

‘CFrame’ is not a valid member of PathWaypoint.

1 Like

So can’t you just create invisible part as finish location?

1 Like

Like what was already suggested, use that vector3 to make a CFrame.

1 Like

That’d be the equivalent of “Humanoid:MoveTo”, technically yes I could but then it’d brainlessly run into walls in the way, it won’t have a brain.

Oh right, it should be CFrame.new(waypoint.Position)

I said nothing, @SteamG0D’s comment is solution

1 Like

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.

2 Likes

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.

1 Like

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.

1 Like

He wants to learn something by making his own system, stop trying to get him to use yours, he’s already made up his mind.

He asked if there was any easier ways to do what he wants, so I did. Don’t criticize something if it has a potential use to someone.

1 Like

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.

2 Likes