I’m trying to pathfind a entity to a target position but the pathfinding waypoints are being created in the ramp part resulting in the entity getting stuck, this is the code:
function entity.pathToTarget(targetPosition: Vector3)
local newPath: Path = PathfindingService:CreatePath({
AgentRadius = entityRootPart.Size.Z,
AgentHeight = entityRootPart.Size.Y,
AgentCanJump = false,
WaypointSpacing = 3
})
newPath:ComputeAsync(entityRootPart.Position,targetPosition)
for _,wayPoint: PathWaypoint in ipairs(newPath:GetWaypoints()) do
entity.move(wayPoint.Position)
end
end
This is how the path generates:
https://gyazo.com/b74c951fefb0607372e42fe176ad5691
Don’t use pathfinding often so I may be missing something. Thanks.