collision issue

Here is little question about UIDynamics .

I have 8 square blocks laid out horizontally across the iPhone screen. Each square is 40 x 40 . Since there are 8 of them, they fill up the width of the 320 screen.

I guess the picture is clear. Now comes the question:

When I apply a vertical gravity towards the bottom the blocks fall as I expect. But when I apply a lateral gravity (left or right) they move by about one pixel or two each. The last being therefore shifted by about 10 pixels or so. Why is that?

I use:

collisionBehave.translatesReferenceBoundsIntoBoundary=YES;

in my code.

I would expect the blocks not to move at all when I apply a lateral gravity.
I think I do not quite understand how the collisions between the moving parts is handled.

Thanks in advance for any tip.


您必须将您的8个方块设置为UIDynamicItemsBehavior并设置此行为的密度。

链接地址: http://www.djcxy.com/p/96780.html

上一篇: UICollisionBehavior:滚球?

下一篇: 碰撞问题