- Home /
Vector3.MoveTowards MaxDistanceDelta value
What is the MaxDistanceDelta value of Vector3.MoveTowards? The documentation says it's the maximum speed it will move toward the target point, but what exactly does it mean by "speed"? Is it based on Time? Is it based on Framerate? Should I multiply the value by deltaTime to make it framerate independent?
Answer by Statement · Mar 26, 2012 at 04:01 PM
Per call.
It means that if you are moving toward target, then maxDistanceDelta is the distance added to step from current toward target. If the actual distance remaining is less than maxDistanceDelta, it will be placed on target position.
So, if maxDistanceDelta is 5, every call will move current 5 units closer to target. It will never "overshoot" the target.
Tyically you will multiply the maxDistanceDelta parameter with delta time.
Answer by Zerot · Mar 26, 2012 at 03:44 PM
Yes, you should multiply it with deltaTime. The speed there is the max speed for every call you make to this function. So if you call it once per frame, then the speed is directly linked to the framerate. If you would call it twice, then it would move twice as fast.
Your answer
![](https://koobas.hobune.stream/wayback/20220613065536im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unexpected behavior on Vector3.moveTowards for Player 0 Answers
conserve momentum of vector3.moveTowards in 2D game 0 Answers
MoveTowards sends object passed target 1 Answer
Setting target position in Vector3.MoveTowards 2 Answers
MoveTowards won't translate on the y axis and lerp leaves character jittering in mid-air 0 Answers