about spritekit and UIBezierPath

what we know:

a bird ---- SKSpriteNode


and we want:

bird ------> Parabolic motion


what we do in our code:


touchesBegan{


let path = UIBezierPath()


path.addQuadCurve(to: targetpoint, controlPoint:controlpoint)


bird.run(SKAction.follow(path.cgPath, duration: 0.2))


}

Replies

The "follow" action orients the sprite node to the path, so it rotates as it moves. Rotating a rectangle makes it bigger in the X-Y directions. The "frame" property is documented to take this into account:


https://developer.apple.com/documentation/spritekit/sknode

"The frame property provides the bounding rectangle for a node’s visual content, modified by the scale and rotation properties."