# Handling angular momentum on collisions

This topic is 3077 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello all,

We've come to a point in our game where we would like to do some limited handling of angular momentum when objects collide. Our game is using pretty simple shapes for collision; in general everything is either a sphere, or a rod( all rods currently have a center of mass midway down the length ). We are using conservation of momentum and energy do dicate all linear velocity changes, and it has been working well. However, when a sphere bumps into a rod, it should also affect the angular velocity of that rod, which is what I am currently investigating.

I have been googling all day, but I haven't figured out how to apply this. There are examples that demonstrate how to calculate torque given a force and a radius, but I don't really have a force to apply here; just a velocity and a mass. I'm also not entirely sure what I would do with the torque, as I believe it represents the change in angular momentum over time, and this is an instantaneous collision.

It seemed likely that I might want to handle the collision via conservation of energy as we do for linear impacts, and I did find the equation for angular energy. Theoretically, it seems that the tangental portion of the sphere's linear energy plus the rod's angular energy should be the same before and after the collision. However, I have not yet found an equation in which I can plug in starting velocities and masses and get a single output velocity.

I looked into the derrivation of the linear output velocity, and it appears that they are using a combination of conservation of energy and conservation of momentum to solve it. Unfortunatley, I don't quite understand all of it and I certainly don't know how I would go about derriving the equivalent for a tangent linear + angular combination.

Would anybody be able to help explain how this works, point me to a good website, or suggest a better approach for my situation?

Thanks very much!

##### Share on other sites
You know, I just found a page about conservation of momentum that almost describes what I am trying to accomplish here:

But the big difference is( if I understand this correctly ), in their example the particle becomes attached to the rod, so they don't need to solve for the resulting velocity of the particle.

So still searching....

##### Share on other sites
Quote:
 but I don't really have a force to apply here

This is quickly off the top of my head and I don't have a complete solution for you. Instantaneous events and point masses can be strange animals. However, if you have a change in velocity (as a vector), you have an acceleration vector.

Haven't played with instantaneous events in a long time. However, you might try something like:

a1 = dV(sphere)

So, with F=ma, F = m(sphere)*dV(sphere)

That's the equal and opposite force on the rod at the point of impact. That force will result in two changes:

A change in velocity of the rod at the center of mass
A change in rotational velocity proportional to the torque T = FxL, where L is the distance from the center of mass to the point of impact (that's a cross product of the vectors).

Torque is the change in angular momentum, so:

T = I * dW, where I=moment of inertia of the rod, dW is the change in angular velocity.

So dW = T/I.

You have a big problem here. The moment of inertia is the integral of the distance from the center of mass times the mass at that distance. Because you've assumed that all the mass is at the center of mass, that distance is zero, your moment of inertia is zero/zed/zilch and the change in [angular] velocity is infinite.

EDIT: Think about getting an object to spin. If someone is at the center of a playground merry-go-round, it's much easier to get it spinning than if a person is at the outer edge. A difference in moment of inertia.

[Edited by - Buckeye on July 15, 2010 12:53:44 PM]

##### Share on other sites
Quote:
 Because you've assumed that all the mass is at the center of mass...

Did he ? I'm not quite sure. But Buckeye has a point, you do need that additional attribute for each of your bodies, namely the so called moment of inertia to get things to work. But I guess you should have figured that out yet, at least from that article.

The approach using the conservation laws should (of course) still apply, but yeah, the derivation is tricky. If you really want to dig in deeper I can recommend this Book. There you will also find C++ code. The author calls the instantaneous change impulsive torque.

With help of this book I achieved some basic physics in 2D, but since I'm still learning I rather not explain anything or I confuse you with something wrong. One hint though: Get your moment of inertia right (The wiki page links to a list of some). I started with some fantasy scale of the bodies mass which made me believe my simulation was wrong (got grotesque angular speeds). It was not, the attributes were.

##### Share on other sites
Quote:
Quote:
 Because you've assumed that all the mass is at the center of mass...
Did he ?

Oops. I assumed that he assumed.. [embarrass]

##### Share on other sites
Baraff's SIGGRAPH course notes on rigid body simulation has a pretty good description of this. Put simply, you apply an impulse to each body at the point of intersection, with the impulse being whatever is required to negate the relative velocity (multiplied by the coefficient of restitution). See section 8 here.

1. 1
2. 2
Rutin
18
3. 3
khawk
15
4. 4
A4L
14
5. 5

• 10
• 13
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633744
• Total Posts
3013666
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!