# Movement problem

**URL:** https://forum.kirupa.com/t/movement-problem/199740
**Category:** programming
**Created:** [September 5, 2006, 4:37pm UTC](https://forum.kirupa.com/t/movement-problem/199740 "2006-09-05T16:37:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![daytonatkf](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@daytonatkf](https://forum.kirupa.com/u/daytonatkf)
#### Post date: [September 5, 2006, 4:37pm UTC](https://forum.kirupa.com/t/movement-problem/199740/1 "2006-09-05T16:37:00Z")

</div>

I’m using this script to move an object. sometime it work, sometime not, it move curve, refer to pic

ang = Math.atan2(yy-pass.\_y, xx-pass.\_x);  
if (pass.\_x\>xx || pass.\_x\<xx) {  
pass.\_x += Math.cos(ang)\*spe;  
pass.\_y += Math.sin(ang)\*spe;  
}

some time it move to b to c first (the curve line) then only to a, i want it move from b to a , is a straight line. how come this happen? thanks for helping
