How do I detect a touch on a UIBezierPath and move a ball along that?

前端 未结 5 2096
孤城傲影
孤城傲影 2020-12-05 12:20

How do I move a ball along a specific UiBezierPath? Is that possible?

I\'ve tried everything including doing a hit test using

-(BOOL)containsPoint:(         


        
5条回答
  •  半阙折子戏
    2020-12-05 12:48

    This is a really hard problem. You'll need to determine the point on the path closest to the touched point, which is a complicated math problem. This is the best thing I could find using a quick Google search. (Beware: the code is in BASIC.)

    http://www.tinaja.com/glib/bezdist.pdf

    I admit, I'm tempted to write this myself. It'd be very useful, and I like a challenge.

提交回复
热议问题