Reputation: 791
Is there a way to rotate an SKShapeNode, specifically a rectangle, around some arbitrary point?
I declared my SKShapeNode at the beginning of my gameScene class
var bladeTouch = SKShapeNode()
and set its path to form a rectangle
bladeTouch.path = CGPathCreateWithRect(CGRectMake(0, 0, 60, 198), nil)
However "bladeTouch" only manages to rotate around its bottom left corner, while my intention is to have it rotate around a point on the middle of its bottom edge. How would I go about translating its path so that this is possible?
Upvotes: 1
Views: 485
Reputation: 385610
This would be simplest:
bladeTouch.path = CGPathCreateWithRect(CGRectMake(-30, 0, 60, 198), nil)
Upvotes: 1