Help with Humanoid:MoveTo()

Hello! I’m doing a system which continously moves animals to random positions in a certain zone, I’m using custom animations and Humanoid:MoveTo() to move the model. The problem is that there is some sort of friction when the movement is completed, which makes the animal go further away.

Here’s the piece of code that I’m currently using for this purpose:

local Zone = pen.Zone

while true do
	local RandomPos = GetRandomPos(Zone)
	local Humanoid = animal:WaitForChild("Humanoid")

	Humanoid:MoveTo(RandomPos)
	Humanoid.MoveToFinished:Wait()
end

Every part of the animal is welded and has CanCollide and Anchored disabled.

Here’s a video of the problem:

1 Like

I assume it has something to do with the inertia and smoothness of the ‘stop’ of the animation coming toward the edge of the zone within the tween of roblox’s “MoveTo” function. I suggest creating another “plate” like part and scale it down to 75% of the size of the zone and use that within your “GetRandomPos” function.

1 Like

Yeah, I thought about this solution, but it still looks weird because of the sudden stopping the part creates and I also want the animal to be able to move to the limits of the zone. I think the best option will be to give up on physics and use tweens with all parts anchored. Thanks for helping though.

Of course! Raytracing could be another option if you’re using moving objects based on boundaries in multiple areas. Furthermore, you could delve into pathfinding :man_shrugging: :stuck_out_tongue: