# Stop a moveTo?

**URL:** <https://phaser.discourse.group/t/stop-a-moveto/994>\
**Category:** Phaser 3\
**Created:** [January 28, 2019, 8:50pm UTC](https://phaser.discourse.group/t/stop-a-moveto/994 "2019-01-28T20:50:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rorywalsh](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/rorywalsh/32/325_2.png) [@rorywalsh](https://phaser.discourse.group/u/rorywalsh)\
**Post date:** [January 28, 2019, 8:50pm UTC](https://phaser.discourse.group/t/stop-a-moveto/994/1 "2019-01-28T20:50:43Z")

</div>

I set an gameObject moving by calling the `physics.moveTo()` function. How can I get it to stop moving once it gets to that point? I’ve tried setting the objects accelration to 0 after it starts, but that doesn’t seem to stop it at all…

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/rorywalsh/32/325_2.png) [@rorywalsh](https://phaser.discourse.group/u/rorywalsh)\
**Post date:** [January 28, 2019, 9:07pm UTC](https://phaser.discourse.group/t/stop-a-moveto/994/2 "2019-01-28T21:07:24Z")

</div>

I just added a collision and set the velocity to 0. Does the trick 😉

---

<div class="post-metadata">

**Author:** ![snowbillr](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/snowbillr/32/332_2.png) [@snowbillr](https://phaser.discourse.group/u/snowbillr)\
**Post date:** [January 28, 2019, 9:51pm UTC](https://phaser.discourse.group/t/stop-a-moveto/994/3 "2019-01-28T21:51:31Z")

</div>

I believe you can also use the `reset` function on the `body` to do this too - [https://github.com/photonstorm/phaser/blob/master/src/physics/arcade/Body.js#L1221](https://github.com/photonstorm/phaser/blob/master/src/physics/arcade/Body.js#L1221)

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/rorywalsh/32/325_2.png) [@rorywalsh](https://phaser.discourse.group/u/rorywalsh)\
**Post date:** [January 28, 2019, 9:52pm UTC](https://phaser.discourse.group/t/stop-a-moveto/994/4 "2019-01-28T21:52:28Z")

</div>

Oh nice. That might work. I ended up doing it using simple vector math and it works fine, so I might leave it at that for now.

---

<div class="post-metadata">

**Author:** ![Telinc1](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/telinc1/32/60_2.png) [@Telinc1](https://phaser.discourse.group/u/Telinc1)\
**Post date:** [January 28, 2019, 11:01pm UTC](https://phaser.discourse.group/t/stop-a-moveto/994/5 "2019-01-28T23:01:46Z")

</div>

[http://labs.phaser.io/view.html?src=src/physics/arcade/move%20and%20stop%20at%20position.js](http://labs.phaser.io/view.html?src=src/physics/arcade/move%20and%20stop%20at%20position.js)

This should be close enough to what to you’re looking for. `moveTo` and similar methods only set an appropriate velocity without stopping at the target. You should check the object’s distance from its target and stop its movement manually (like snowbillr suggested) if it’s close enough. That’s necessary because it will almost never reach the exact position - it’ll likely be fractions of a pixel (or, sometimes, more than a pixel) away because of the movement.
