Newton's Cradle sim problem.
Posted: Sat May 28, 2011 9:17 am
Hi there,
Inspired by a problem in a 3D engine (in a 3D software package) I want to code the Cradle simulation myself. As these are the first bits of code I'll do in lua/love I'm sure to make mistakes. This is, of course, a purely physics based sim.
Problems:
- The circle that should initiate the sim is not where it should be when the sim starts. If I turn off gravity it is in the correct place. Anywhere from 1 to 320 gravity in the Y-direction and it will "jump" back to it's coded position. >320 breaks it entirely.
- The circle that initiates the sim pushes everything away, and not just the last one. Is this because of how Box2D works?
I'm setting the mass with the function getMassFromShapes(), which was the proper way of doing it (that's what I read on the wiki)?
The rectangles have no mass so they can not fall, and the circles have a DistanceJoint to the rectangles.
Inspired by a problem in a 3D engine (in a 3D software package) I want to code the Cradle simulation myself. As these are the first bits of code I'll do in lua/love I'm sure to make mistakes. This is, of course, a purely physics based sim.
Problems:
- The circle that should initiate the sim is not where it should be when the sim starts. If I turn off gravity it is in the correct place. Anywhere from 1 to 320 gravity in the Y-direction and it will "jump" back to it's coded position. >320 breaks it entirely.
- The circle that initiates the sim pushes everything away, and not just the last one. Is this because of how Box2D works?
I'm setting the mass with the function getMassFromShapes(), which was the proper way of doing it (that's what I read on the wiki)?
The rectangles have no mass so they can not fall, and the circles have a DistanceJoint to the rectangles.