Skip to content

Instantly share code, notes, and snippets.

@Tokuriku
Last active August 29, 2015 14:13
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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
//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