I’m trying to make a tower defense game and I wanted to make a quick enemy. The system I used to navigate the enemies around the map is a waypoint system where they walk to set waypoints in order until they reach the end. The issue is I’m trying to make a quick enemy and when I set the enemy’s humanoid walk speed to 20 when they turn to face the next checkpoint they slide in the direction they were previously moving before moving in the direction of the waypoint. Does anyone know how to remove a sliding effect? (Also if this is explained badly here’s a video. And I’m sorry about the video quality.)
robloxapp-20211223-2213315.wmv (3.3 MB)
If anyone knows how to make a humanoid stop on a dime and not slide please let me know.
Could you briefly anchor the enemy’s rootpart once it reaches a waypoint, reorient its CFrame to face the next one, then resume walking? It looks like the problem is that it’s at such speed when it immediately begins walking to the next point that turning to face the next point carries too much momentum.
*This would also be a wise point to explicitly set its CFrame to the waypoint when the enemy’s MoveTo has finished there to ensure it stays within the path visually.
Sliding can happen when the hipheight is too low, the model is unable to put it’s feet down and enters freefall but unable to fall. You can manually set it higher until sliding stops. If they start floating, you went too far.
You can check for the falling state, but it’s easier to mess with hipheight
Ok so this is kind of worked but kind of didn’t
for Waypoint=1, #Waypoints:GetChildren() do
zombie.Humanoid:MoveTo(Waypoints[Waypoint].Position)
zombie.Humanoid.MoveToFinished:Wait()
end
This for loop is used to navigate the enemy around the map.
for Waypoint=1, #Waypoints:GetChildren() do
zombie.Humanoid:MoveTo(Waypoints[Waypoint].Position)
zombie.Humanoid.MoveToFinished:Wait()
if zombie.Humanoid.MoveToFinished then
zombie.HumanoidRootPart.Anchored = true
zombie.HumanoidRootPart.CFrame = Waypoints[Waypoint].CFrame
zombie.HumanoidRootPart.Anchored = false
end
end
This is the one I made after your suggestion. It kind of worked but after it was unanchored it still kept sliding in the direction it was previously moving. Its an improvement at least. But then I could be doing the script wrong.
But thanks for the suggestion like I said it was an improvement
robloxapp-20211224-0927219.wmv (3.3 MB)
robloxapp-20211224-0924002.wmv (3.4 MB)
Once again sorry about the video quality
Bumped up the hip height by one and the enemy was floating and sliding.
Didn’t fix it but thanks for the suggestion.
“HumanoidRootPart” is invisible and has a default size of 2,2,1. Might want to check if that is properly reduced in size.
Another thing you can try is turning off all collisions. If that fixes it, something is clipping the ground. Try switching CollisionFidelity to PreciseConvexDecomposition. If all parts are accounted for, then it’s possible the models are too small.
The HumanoidRootPart is already to scale being 0.8, 0.8, 0.4.
Turning off collisions and changing to PreciseConvexDecomposition didn’t change anything.
I might not use a Humanoid and instead use lerping or tweening to move the enemy. But if I am able to fix this issue and still use humanoids it will make my job a lot easier. But yet again thanks for the suggestion.
I might go dig around to see how games like TDS handle this just to see if it leads somewhere.
Have you tried setting the AssemblyLinearVelocity
of the humanoidrootpart to Vector3.new(0, 0, 0)
?
I’ve decided to just use tweening instead because I can just do more with it than using humanoids. Yes tweening takes a lot more time to use but I think in the long run its worth it.