Skip to content

angle_difference

drewmccluskey edited this page Jan 23, 2019 · 4 revisions

angle_difference

returns the pixel distance between two points based upon either two vector points or 2 sets of X-Y input points.

Syntax:

angle_difference(double src, double dest)

Vector

Argument Description
double src First angle
double dest Subtractive angle

Returns: double

Description:

This function will return the difference between two input angles within -180 and 180. It is used to gather information to know which direction to rotate in the quickest way to get to a specific direction.

X-Y Example 2:

var driftAngle = angle_difference(direction, image_angle);
direction -= min(abs(image_angle), 15) * sign(driftAngle);

Above code will rotate an object's image angle towards its nearest current direction by an incremental method.

Back to Vectors

Clone this wiki locally