-
-
Notifications
You must be signed in to change notification settings - Fork 18
angle_difference
drewmccluskey edited this page Jan 23, 2019
·
4 revisions
returns the difference between two angles within -180 and 180 return values.
angle_difference(double src, double dest)
Argument | Description |
---|---|
double src |
Current angle |
double dest |
Desired angle |
Returns: double
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.
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