Determining what angle an object is moving at?
BlitzMax Forums/BlitzMax Beginners Area/Determining what angle an object is moving at?
| ||
o.x = o.x + o.xdir o.y = o.y + o.ydir xdir, ydir could be any values, etc, etc. They might have thrust or gravity values applied to them as well. So, what would be the easiest way to find out the angle it's moving at? I thought about keeping track of previous positions and getting the angle on old and current. But I'm thinking there's an easier way? Thanks for any help. ;) |
| ||
Angle = atan(o.ydir/o.xdir) ? |
| ||
Im getting...ZZZzzzz long night. ;) Thanks Zig, it's close but since Blitzmax uses 0 for 90 degrees I have to do something to make that work. Any ideas? Thanks! |
| ||
This did the trick... ;) angle = ATan2(yspeed, xspeed) If angle < 0 angle = angle + 360 End If |