Deprecate FlxPoint.angleBetween
and make angles consistent
#2482
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #2037 and #956
Created
FlxAngle.angleFromOrigin
, and changed every "angle from coordinates" util to use it, just about everywhere and made 0 degrees point RIGHT everywhere. 2037 hit a road block looking for a "fast atan", but I hardly think it's worth the extreme lack of precisionI ran some speed tests, here:
is it faster? Ignoring neko, it's roughly 2-3 times faster when adjusted against a simple literal return! however, these gains will likely never have a significant impact, and if someone needs that optimization (and less precision), they probably know how to make their own. Even if we could fix the lack of precision, this speed bonus just seems frivolous. However if we do want to replace
Math.atan2
with something else, we can now change one spot to affect everything in the framework.Note: FlxSwipe and FlxPath angles no longer have their previous 90 degree offset. this should be the only backwards compatibility issue this PR introduces
Additional changes
degreesBetween
,radiansBetween
,degreesBetweenPoint
,radiansBetweenPoint
,degreesBetweenMouse
,radiansBetweenMouse
,degreesBetweenTouch
andradiansBetweenTouch
getCartesianCoords
,getPolarCoords
andangleFromFacing
degrees
andradians
fields toFlxDirectionFlags
to replaceFlxAngle.angleFromFacing