Tuesday, 14 June 2011

Collisions ( Part II )

  • Change directions and speeds of the elements using mechanics 

 Directions


The f angle we found in the last part will enable us to find the new directions :

Indeed, by rotating it for 90°, we find the tangent of the collision ( black line on the figure ).
Then, the reflection law on this tangent gives you the new direction angle of the source element, which formula is :

newAngle =  2 * ( f + Pi/2 ) - b 

where f+Pi/2 is in radians the angle of tangent and b the initial direction angle of the source element.

 If the target element can me moved, then its direction is simply the angle f.

Speed

The formulas used to calculate new speeds are again the ones founded on this website :
http://amrita.vlab.co.in/?sub=1&brch=68&sim=197&cnt=1

So, in order to be able to calculate the momentums, the elements have know a mass parameter.

The following is a direct application of these mechanic formulas, so I'm not going to explain it here.

Collisions with the board

Two things must be programmed here :
  • Collision with sides
As the platform is supposed to represent the world, I chose, for the moment, to suppose that when an element goes out, the program replace it on the side of the board. So, there are no reflection law applied here, unless, for example, for pool game.
  • Friction forces on the board
The elements have also a friction coefficient as a parameter, which depends on their material, and the one of the board. I supposed the balls rolls without slipping, and so the only force active on the board is the ground reaction.
So, the fundamental princple of dynamics gives a constant acceleration of - g * f, where f is the friction coefficient, and g the constant of earth's gravity.
g has a value of 10, and I'll take 0.35 as friction value for ball/croquet ground, because this is within the range used for pool :
http://billiards.colostate.edu/threads/physics.html

Here ends the part about collision.

No comments:

Post a Comment