Problems with moving AI

Hello!

I’m at the moment using Defaultio’s BTrees-plugin to create an AI system for my game. One of the tasks inside of my tree is a movement task witch makes the deer walk over to its destination. I use PathfindingService to generate the route and Humanoid:MoveTo() to move my deer to the next point inside of my waypoint-table. My problem occurs when using the Humanoid:MoveTo() function. The deer rotates in the direction of the destination and then stops unable to move (and yes, non of the parts inside of the deer is anchored). Here is a clip of it:robloxapp-20210704-2000181.wmv (2.0 MB)

I’m writing out to the community if any of you claver-minds has any idea of what I’m doing wrong. All help is appreciated :slight_smile:

can you show me the explorer of the deer? (all the parts inside of it)

Sure, here is a screenshot of it.

image

ok and can u show me the code where u move it

This is the movement-part

and this is the part witch returns the waypoints

ok so it could be potentially two stuff:

try changing the path to

local path = pathfindingService:FindPathAsync(root.Position, way)

if that doesn’t do anything try (and ik it seems weird) to check if there’s any humanoids that are left in the workspace, if so delete them. just go to your explorer and type Humanoid and see if there are any in workspace that are not modeled to anything

I tried both non of them made the deer walk

try to print the number of waypoints to see if there’s any waypoints

local waypoints = path:GetWaypoints()
print(#waypoints)

(debugging purposes)

I tried earlier to create parts witch position i set to the position of the waypoint

(worked as supposed)

then i’m pretty sure it’s the magnitude line, if it’s still then obviously the magnitude is 0 right?

not sure what c is but try removing the whole if statement that breaks your loop

I tried that but it didn’t make the deer walk. But I actually dont think the problem is located inside of the code but rather that the deer gets stuck in the terrain.

are you sure all of the parts are unanchored?

Ok i placed a little part witch functions as a collider under it. Now it can move but its moving pretty weird robloxapp-20210704-2037295.wmv (1.9 MB)

Ok i found the solution! I tried changing the hip height of the humanoid and that made the deer move for some reason.

1 Like