Last active
August 29, 2015 14:13
-
-
Save Tokuriku/f29559ef154068366dd1 to your computer and use it in GitHub Desktop.
Remapping a CGPoint for use with SKPhysicsJoints in a non CGPointZero anchorPoint Scene
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To be applied to the anchor point | |
func remapPoint(point: CGPoint) -> CGPoint { | |
let correctedX = point.x + self.size.width * self.anchorPoint.x | |
let correctedY = point.y + self.size.height * self.anchorPoint.y | |
return CGPoint(x: correctedX, y: correctedY) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment