Having trouble with my pixel-movement code, which I'm pretty sure is having problems with Vector3.Angle Made in java, kind of stumped.
I want dir_difference at this point to be 0-360, but it's instead returning 6-9, passing the endpoint without changing very much.
The rest of my code should work well enough, since it's splitting it down to a 0-7 int which I use to move the pixel.
EDIT: To clarify, I'm looking for something that would return something akin to
The arguments to Vector3.Angle are themselves directions; you seem to be passing in positions.
Try subtracting the two positions to get the vector: vec = endpoint - loc
The length of this vector is the distance between the two points; the "slope" of the vector is the direction to travel. You can then convert this into an angle using the Vector3.Angle method. But, you need a starting angle. For example, you might choose the X-axis as your starting angle:
You can then use this angle to assign an integer (0-7) to the direction as you had planned to originally. (Although, that code may also need tweaking. What's dir_2 for? Is dir the last calculated direction?)