开发者

Ball & line drawing & collision detection iPhone

Im making an iPhone app where the user draws a line with their finger (the line will be straight line between where the touch began and ended). I also have a ball which will fall and hit the line. What is the best / easiest way of handling the i) drawing, and ii) collisions?

I am completely new to this and open to any ideas or so开发者_如何转开发urce code.


I have decided to use CoreGraphics to draw the line, and to store the points in cgpoint arrays. Then, I use the parallel distance formula to calculate when the distance of the ball to the line nears zero (funny, it has never equaled zero, even though the timer repeats every 0.01). Then a collision has taken place, and I use simple applied maths vectors to calculate the resultant is the coefficient of restitution is 1

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜