Class MultipleCollisionTest

Unit tests of ImpulseSim, for cases involving multiple simultaneous collisions.

Note that these tests are sensitive to the settings for `VELOCITY_TOL` and `DISTANCE_TOL` in ImpulseSim.

Methods

• 'center spin': There are two stationary blocks with a third block in between them; the center block is spinning and will simultaneously hit the other two blocks. This is similar to the 'one hits two separate' scenario, except its a spinning block instead of a translating block that causes the collision. There are no static contacts so either ImpulseSim or ContactSim shows the same results. This corresponds to the 'center spin' version of the interactive SimultaneousCollision test.

Returns void

• Show that get same results with elastic or inelastic joints.

Returns void

• Show that get same results with elastic or inelastic joints.

Returns void

• The simplest case of a 'spinning joint': two bodies connected by a joint, they are rotating about the joint at different rates. This shows that we are unable to keep spinning joints tight with just contact force calculations.

Returns void

• Two rectangle blocks are connected by a joint; the blocks are at rest with a ball object in contact with them on their right; from left a ball object strikes the jointed rectangle blocks.

Returns void

• Two blocks are connected by a joint and lie on the ground; a third block collides into the connected blocks. This is a fairly simple test of joints and contacts during a collision.

Returns void

• Two balls are inside a rectangular frame. A third ball strikes the frame from left. This causes an infinite series of collisions, but certain settings for the collision handling can cope with this problem. See Physics Based Animation by Erleben, et. al. Chapter 6-2 'Multiple Points of Collision'.

Returns void

• 'one hits two separate': a moving block hits two separated balls simultaneously. The result depends on the type of collision handling used. Because there are no static contacts, but only two dynamic collisions, we can use ImpulseSim here (don't need to use ContactSim).

Returns void

• 'one hits wall': Square block collides into a wall, both corners simultaneously. The result depends on the collision handling mechanism.

Returns void

• 'side spin': There are two stationary blocks in resting contact, with a third block nearby; the third block is spinning and will hit one of the two blocks. This is similar to the 'one hits two' scenario, except its a spinning block instead of a translating block that causes the collision. Because this test involves resting contacts, we must use ContactSim. This corresponds to the 'side spin' version of the interactive SimultaneousCollision test.

Returns void

• With sequential or hybrid collision handling, the block bounces straight off the wall.

Returns void

• With serial collision handling, the block starts rotating.

Returns void

• With simultaneous collision handling, all the balls are moving after the collision (which is physically wrong, but it is how it should behave).

Parameters

• balls: boolean

true gives round balls, false gives square blocks

Returns void

• With serial or hybrid collision handling, the result is only the right-most ball is moving.

Parameters

• balls: boolean

true gives round balls, false gives square blocks

Returns void

• 'one hits two': A ball (or square block) on the left moves to hit two balls that are in resting contact. The result depends on the type of collision handling being used. Because resting contact is involved, we need to use ContactSim instead of ImpulseSim.

Parameters

• sim: ImpulseSim

the ImpulseSim to add the objects to

• offset: number

additional distance between the stationary objects

• balls: boolean

true gives round balls, false gives square blocks

Returns void

• With simultaneous collision handling, all the balls are moving after the collision (which is physically wrong, but it is how it should behave). OCT 2011: for some unknown reason, the “two hits one asymmetric” multiple collision test now works identically for all collision solvers. MAY 2016: I've solved the above problem, see the setup function above.

Returns void

• With serial collision handling, the center ball remains motionless, and the two balls exchange velocity.

• Parameters

• balls: boolean

true gives round balls, false gives square blocks

Returns void

• 'one hits two on wall': two balls (or blocks) are in stationary contact with a wall (infinite mass); a third ball collides into them from the left; the result is usually that the ball just bounces off and the two balls stay in stationary contact. The exception is when using serial collision handling and square blocks instead of round balls (because then the two corner collisions on the blocks are handled serially instead of simultaneously). Because this test involves resting contacts, we must use ContactSim.

Parameters

• balls: boolean

true gives round balls, false gives square blocks

Returns void

• Serial collision handling case: non-symmetric result.

Returns void

• Simultaneous collision handling case: symmetric result.

Returns void

• Simultaneous collision handling case. Note (March 30 2011): This failed with ContactSim.VELOCITY_TOL = 0.5, so I lowered VELOCITY_TOL to 0.05. The problem was that energy was increasing after the collision; the cause was that a contact was being detected that had a relatively high velocity of 0.28, and a contact force was acting there (and because work = force * distance, there was energy being added as the contact was separating).

Returns void

• Hybrid collision handling case.

Returns void

• Serial collision handling case.

Returns void

• 'Two hits one asymmetric': Two balls approach a central stationary ball so that the collisions happen at the same moment; the balls have different velocities. The result should be that the central ball should remain motionless and the moving balls bounce off but exchange velocities. Because there are no static contacts, but only two dynamic collisions, we can use ImpulseSim here (don't need to use ContactSim).

• Here is why we need to add distTol/2 to starting position of body1:
• The collision happens when the blocks are distTol/2 apart, so the distance
• travelled is slightly less than you would expect.
• Suppose distTol = 0.01; and distTol/2 = 0.005.
• body2.left = 0.5; body3.right = 2.5; body3 travels 2.5 - 0.5 - 0.005 = 1.995
• If body1 starts at -5, it travels a distance of 3.995 which is more than
• twice the distance that body3 travels, so it arrives after body3 collision.
• To have them collide at the same moment:
• Since body1 travels at twice the speed, it should travel 1.995 * 2 = 3.99
• Therefore body1.right = body2.left - 0.005 - 3.99 = -4.495
• Therefore body1.center = -4.995 = -5 + distTol/2

Returns void

• Two balls are inside a rectangular frame. One ball is given a rightward initial velocity. This causes an infinite series of collisions, but certain settings for the collision handling can cope with this problem. See Physics Based Animation by Erleben, et. al. Chapter 6-2 'Multiple Points of Collision'.

Returns void

Generated using TypeDoc