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