# Angular velocity from 2D Collision

I have been working on a 2D physics engine for my A Level computing project and I am having trouble calculating the angular velocity from a collision. I have managed to workout each objects linear velocity and create a collision manifold containing the collision points relative to each of the 2 objects involved in to collisions centre of mass (0, 0) along with the overlap etc. I also know each objects mass, speed etc. I have been looking for a couple weeks now at every equation I can find and non of them seem to work returning incredibly high numbers for normal collisions. My current algorithm pulled from an article in the game development section on tuts+ (linked here) is like so:

objectArray[i].angularVelocity += objectArray[i].inverseMass * CrossProduct(collisionInfo.collisionPointB, impulse);
objectArray[ii].angularVelocity += objectArray[ii].inverseMass * CrossProduct(collisionInfo.collisionPointA, impulse);


Could someone please explain how I can calculate the change in angular velocity and give me some example values for the equations as mine are probably in the wrong scale or something.

Thank you for any help, Andy A

Other things to note, this engine is written in C# for XNA so if there are any language specific optimisations they have to work with C#, thank you.

• What are the coordinate systems for your collosionInfo.collisionPointX values? They would each need to be in the local mass-centered system for their associated body. Otherwise they could yield too-high values. – Seth Battin Jan 26 '14 at 18:35
• They are both relative to the centre of mass of each object, ie collisionPointB is relative to objectB's centre of mass. The impulse is calculated to be pretty high but it works for linear collisions. And when it's really low objects just pick up speed. – Andy A Jan 26 '14 at 18:45
• I didn't really deviate from the tutorial, I made it kinda from scratch and pulled the bottom 2 lines directly from the bottom of the tutorial. They seemed to make sense but I will replace that with anything assuming it works. My code is a whole mess and at college so I will update as much as I can when I can. Thank you. – Andy A Jan 26 '14 at 21:38

## 1 Answer

I was struggling on the same question so I looked after some clue on physics.stackexchange

this post about the collision theory was very helpful. Code snippets inside.

If you are looking for something more complete, then take a look at this wikipedia page about the impulse based reaction model which contains some interesting infromation about angular velocity that may sound a littlebit complicated. But if in your model you make use of inertia and impulse concepts this may be resolutive.

For my personal purpose I took advantage of calculations expressed in the first link to get impulse value and then used a formula like

Va = (V * sin(angle))/r


given

• V = your particle velocity
• angle = angle between V and r
• r = distance from rotation axis
• It looks a lot better than it did, still fiddling around with stuff to make it great. Thanks a lot for your help. – Andy A Jan 28 '14 at 20:21