#[kind of fixed] How do I get blockcasting to work for the player to pathfind off ledges (a*)

1 messages · Page 1 of 1 (latest)

tame gust
#

so like i tried fixing it? but whenever i did manage to fix it; it kept completely ignoring walls and tried pathfinding through them, i completely removed the original code that fixed it and ignoring walls to the code that was working previously, but still having the same issue to where it refuses to dropdown ledges

tame gust
#

cus if the point isnt valid we find the nearest point and recalculate after reaching it

proven hound
#

pretty sure recursive will stack overflow eventually

tame gust
#

but like
i dont WANNA use a while loop 😢

#

while loops are evil to me bruddah

proven hound
#
function movePath(g, p)
    local ctrls = require(lp.PlayerScripts.PlayerModule):GetControls() -- for some reason the player cant jump correctly with controls enabled
    ctrls:Disable()
    for i = 1, #p - 1 do
        local tp = g[p[i+1]].pos
        hum:MoveTo(tp + v3(0, 0.5, 0))
        hum.MoveToFinished:Wait()
    end
    ctrls:Enable()
end```
movetofinished is a newb trap, biggest problem for this code is it times out after 8 seconds and has a reachedDestination parameter you're not using but you're cooking a custom a* algorithm here so i dont think thats going to be a problem this time since you build a similar output to pathfindingservice
tame gust
#

mkay mkay mkay
thank u tho bruddah

#

i havent had any issues with it so far so i just kept using it LMFAO

proven hound
#

what is meetpoint?

tame gust
#

so like i create two paths from the player and from the goal and the two just tries calculating to a middle point to connect the two

proven hound
tame gust
#

probabblyyyy but thats there the blockcasting comes into play

#

though both of them use blockcasting not just one path

proven hound
#

when your a* returns valid value lua local p, fromStart, closedStart = biAStar(g, si, gi) if p then movePath(g, p)
it calls this function return reconstructPath(fromStart, fromGoal, meetPoint) -> ```lua
function reconstructPath(fromStart, fromGoal, meet)
local path = {meet}
local curr = meet -- add path from start to meeting (reverse)
while fromStart[curr] do
curr = fromStart[curr]
table.insert(path, 1, curr) -- insert at beginning
end
curr = meet -- add path from meeting point to goal
while fromGoal[curr] do
curr = fromGoal[curr]
tins(path, curr) -- append to end
end

return path

end```
looks like it's an id? but if its an id, why is it in the path?

tame gust
#

its because its alot more efficient to use ids instead of ykyk you can very easily access ids, and some guy a while ago told me that was the way to go and i just went on with it from there

#

i'm just going with the flow man 😭

#

and i've been on this blockcasting bologna for the past week or so

#

its just cheaper to store ids than vector3 objects

proven hound
tame gust
#

mkay i'll do that rq and i'll be back with you in a min

proven hound
#

but see if that ray was hitting the character, or anything immediately stopping your character, then it probably wouldn't pathfind at all

#

so i really dont think it's your raycast, i think your path may be wrong. maybe add in some debug parts so you can see where all the waypoints are?

#

do be sure to .cancollide=false and .canquery=false so they dont hit rays or the npc

tame gust
#

yasyayaya dwdw
ive had ALOT of problems in the past from just accidentally forgetting that 😭

#

i'll show you the details in a bit mr man

proven hound
tame gust
#

sometimes the pathfindingservice is dumb and i got fed up with it and decided to do all this

proven hound
#

any issues you encountered are skill issue

#

it's very, very rare that you actually need to make your own for something pathfindingservice cannot already do, but even in those cases, you'd need to use a navmesh, not the nodegraph you have created.

#

or if you're going to roll with a nodegraph, use a proper nodegraph instead of a giant 1x1x1 grid

tame gust
proven hound
tame gust
#

LMFAO
SORRY I OUTPUTTED THAT WRONG

#

when i DID fix it
i went back to the original set after it didnt work i meant 😭

proven hound
#

this doesn't appear to do anything since the distance between any 2 cells on your grid are guaranteed to be less than both md and sh lua if dy > 0 then -- moving from higher to lower (dropping down) canConnect = hdif <= md -- dropping - use drop limit else canConnect = hdif <= sh -- stepping - use step limit end

#

oh god main is in a while loop, i somehow overlooked that lua function main() local tgt = workspace:WaitForChild("target") while true do local g, gridMap = genGrid() connNb(g, gridMap)

tame gust
#

nonoo i just added that in with the adjustment 😭

proven hound
tame gust
#

dwdw

#

back to the drawing board i go

proven hound
# tame gust MAYBE A SKILL ISSUE BUT I AM TRYING ALAS yes its mainly just a learning type exp...

your gridsize is too small for the smallest dropsize lua local gridSize = 150 -- gridSize: total size of the navigation grid local md = 100 -- maxDrop: maximum height a character can drop down
since the grid is centered around the player (therefore radius is 75 studs) and the maximum drop height is 100 studs (greater than 75), and that does look like a long fall. i dont think its 75 studs but y'know, have to check everything

#

tbh you should probably just use pathfindingservice or hire someone coz this is not trivial code

#

you got a lot more debugging to do if you want to continue with this salute

#

i suggest adding more visualization, debugging, maybe temporarily disable the step height etc

#

i'm too limited to help you further without properly running and testing this code

#

and ngl i highly doubt many people here are able to, or (those who can) have the time to help you with this

tame gust
#

RAHHHHH
dw mannn
I'll figure it out eventually 😭

proven hound
tame gust
#

i'll scream like a girl when this day happens 🫡

tame gust
#

also for edge thang i figure to just have the blockcast ignore nodes that goes down relative to the player as a simple bandaid fix

tame gust
#

[kind of fixed] How do I get blockcasting to work for the player to pathfind off ledges (a*)

gusty mantleBOT
#

studio** You are now Level 8! **studio

proven hound
tame gust