- Home /
Finding the speed of MoveTowards
How would I determine the speed of a game object that I'm moving with Vector3.MoveTowards. The Rigidbody's velocity isn't changed, and I'm not sure where else the speed would be found.
Answer by tmalhassan · Sep 21, 2017 at 03:12 AM
Hello, @NedStormFish.
The way that MoveTowards()
works is that it moves an object from current point, in a straight line towards a target point.
Vector3.MoveTowards(currentPoint, targetPoint, speed (float));
You can also refer to this for further information: https://docs.unity3d.com/ScriptReference/Vector3.MoveTowards.html
Hope this helps :)
I've been using $$anonymous$$oveTowards() a little bit already. I just wanted to know if there was a way, in a script, to tell if the object is moving. If I used AddForce(), I could look at the Rigidbody velocity and tell none of its components are zero. I could compare position coordinates every frame with what they were the previous one, but I'd rather find an alternative.
Your answer
![](https://koobas.hobune.stream/wayback/20220612135307im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
New Unity problem 1 Answer
Speed after Vector3.Reflect Decreases,Speed of ball after Vector3.Reflect decreases 0 Answers
Detecting Vector3 Movement speed. 2 Answers
Making Top-Down spaceship movement, getting current speed, acceleration, without rigidbody! 1 Answer
How can i keep global scale of object while instantiate it 1 Answer