Domanda

I have this classic situation of a pinball game

All objects are physicsBody with rights collision masks and so on.. they collide perfectly. The problem is that they only work when they are static...If I try to rotate a paddle on its anchorpoint, there is no collision with the ball and the ball falls down, passing through the paddle.

I thought it was a problem of speed but I think that during the rotation the physicsBody simply doesn't work.

Do you have suggestions?

Thank you so much.

È stato utile?

Soluzione

That's exactly the problem you get when rotating a static body, it's not going to act physically correct.

For example static bodies have no force, no velocity - if you move or rotate it, it will just be there at the new position and new rotation without pushing any dynamic bodies around. Only if a dynamic body now happens to be intersecting with the static body will the physics engine try to resolve the collision, usually in a brute-force manner (aka "get me outta here").

Therefore the paddle has to be dynamic if you want it to move, accelerate and spin the ball. Both paddle and ball may need to have continuous collision detection enabled as to not lose any precision in the paddle motion applied to the ball, and vice versa.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top