hello so i’ve been wondering is there a way to make a humanoid to walk to a exact point since humanoid:MoveTo(Vector3) doesnt move to exact position many people been telling me to snap it when humanoid.MoveToFinished is fired but the rig is like 12 studs far snapping it would pretty much just be teleporting, so is there a better way? and what is that way?
I tried:
tweening the rig’s HMR by calculating distance and dividing it by speed but that also doesnt seem to work perfectly since on the client it looks all jittery
local part = game.Workspace.Part -- Change the part location
local characterHumanoid = game.Workspace.Dummy.Humanoid -- Change the location of the character / humanoid
characterHumanoid:MoveTo(part.Position)
Its probaly this can work, but it wont have a smooth walking and will instantly move to the part. You will need to learn PartFindingService for smooth character walking.
Maybe try printing the position you are trying to move it to, then check where the HumanoidRootPartPosition is.
I’m not sure, but I’m wondering if a difference in Y Position could cause it to stop because it’s trying to move into a Position under the ground or in the air.
You could do a distance check of the HRP and the position. Then keep firing MoveTo until the the distance is within acceptable range or exact. Although you may want to ignore the Y value unless the position is at the exact same height as the HRP.
local hrpPos = HRP.Position * Vector3.new(1,0,1)
local myPos = thePos.Position * Vector3.new(1,0,1)--Clear Y
local dist = (hrpPos - myPos).Magnitude
if(dist <= 0)then
--You could alter this to get you within a 1-2 studs and do the snap to pos to be perfectly accurate.
print("At position!")
end
When I use pathfinding. I never actually use the MoveTo Wait at all. I use this method to be more accurate and avoid hang ups.
Maybe this could be happening since the dummy has a certain velocity from walking so it wont exactly stops where it should, try setting the Velocity of it to 0 when it reaches the point where it should end
humanoid.MoveToFinished should be the key in here. Can you show me the code on how you use movetofinished?
In case you didn’t use it correctly.
-- MoveToFinsihed has a timeout of 8 seconds.
local Timeout
repeat
-- loop everytime the humanoid hasn't reached the position
humanoid:MoveTo(Vector3)
Timeout = humanoid.MoveToFinished:Wait()
until Timeout