Physics: Objects in linear collisions getting out of alignment

I am creating a physics-engine based musical instrument: 5 paddles and 5 balls lined up in 5 columns. Each time a ball hits a paddle a note is triggered. The physics engine is behaving strangely - objects that should be bouncing straight up and down get out of alignment and fly off diagonally.

Am I missing something fundamental in how box 2d works? Source code is here: https://www.dropbox.com/sh/zreo4o96h19mtlx/afE1sct9_-

-Peter
[import]uid: 89362 topic_id: 37557 reply_id: 67557[/import]

Hi there,

The physics engine isn’t 100% perfect. I noticed in your sample that the object that bounces off diagonally is a circle, and it’s moving very fast. I suppose even a rounding error could eventually grow into something significant and cause it to spiral in a different direction.

If you want to force them to always stay in the same column no matter what, you might want to include a function that you call every frame (using the enterFrame listener) that sets they’re x value each frame.

  • Andrew [import]uid: 109711 topic_id: 37557 reply_id: 145784[/import]

Hi there,

The physics engine isn’t 100% perfect. I noticed in your sample that the object that bounces off diagonally is a circle, and it’s moving very fast. I suppose even a rounding error could eventually grow into something significant and cause it to spiral in a different direction.

If you want to force them to always stay in the same column no matter what, you might want to include a function that you call every frame (using the enterFrame listener) that sets they’re x value each frame.

  • Andrew [import]uid: 109711 topic_id: 37557 reply_id: 145784[/import]