How can you get a SpriteNode to follow a BezierPath by using touchesMoved?

I'm trying to move a SpriteNode to follow along a BezierPath. But I want it to follow the path based upon touchesMoved.


Simple example would be to have a BezierPath that is a circle. I want the node to move around the circle based on sliding your finger left and right to go clockwise or counter-clockwise around the circle.


I also want it to continue around the circle more than once if the move continues.

Replies

You can try to use this function to move a node along a path: https://developer.apple.com/documentation/spritekit/skaction/1417662-follow. You can retrieve a CGPath from UIBezierPath.

Use touchesMoved events to pause this action or reverse it.