Enjoy BYOND? Contribute today!
Degrees - Rotation
Aug 9 2005, 11:58 pm
What's the formula for a var that returns the degrees in a full rotation from Point A(src) to Point B(src.target) using trigonometry in the DM language?
Aug 10 2005, 12:17 am
The what? Umm... Do you mean the angle between point a and point b? Well, if that's the case, use the getangle() proc. Look it up in the reference. It's inaccurate, but good enough for a tile based system like DM.
Otherwise, use a bit of right angle trig:
sin d = abs(a.y-b.y) / (distance between a and b)
Where d is the angle. You get that from right angle trigonometry.
Aug 10 2005, 12:54 am
In response to
Uh, yeah, I mean I need to get the Direction Point B is from Point A.
That formula doesn't work, by the way... At least not the way I tried it, it might do if I did it right...
var/deg = sin(abs(src.y-src.target.y) / (get_dist(src,src.target)))
Copyright © 2013 BYOND. All rights reserved.
Terms of Service