I cannot derive this equation on my own

Started by
11 comments, last by Gzagenius 19 years, 9 months ago
Hi, I'm reading physics for game developers. I have implemented linear collision detection and impulse based collision response using the equations presented in this book (specifically on page 96, and I can now derive the linear impulse equation in my sleep). I thought that including angular momentum to calculate the impulse force would be trivial, but it is not. On page 98, the final equation for the impulse force which includes angular momentum is: J = -vr(e+1) / (1/m1 + 1/m2 + n * [(r1 x n)/I1] x r + n*[(r2 x n)/I2] x r) vr is the relative velocity. e is the coefficient of restitution, m1 and m2 are the masses of the two colliding objects, r1 and r2 are the radiuses connecting the center of mass and the point of application of the force for each body, and n is the normal of the collision. Essentially, the book takes the basic equations for coefficient of restitution, linear and angular impulse, and uses them to solve for the force. He doesn't show how he gets the final product, and I don't think I know how to use it correctly. For example, I'm not sure why he throws the normal into the equation. It seems it should be force, not the normal (this is what I have seen in other sources, and the difference is that although the force and normal act in the same direction, their magnitudes are different, and doing a vector crossproduct on each of them yields different results). Here are the basic equations that are given in the book, which give rise to the final equation for the impulse force: Linear Impulse: Force * dt = mass * (velocityafter - velocitybefore) Angular Impulse: Torque * dt = MomentInertia * (angularvelafter - angularvelbefore) Coefficient of restitution = - (V1a - V2b) / (V1b - V2b) V1a = Velocity of body 1 after impact, V1b = Velocity of body 1 before impact, etc. So, essentially, to solve for the impulse force he begins substituting everything into the equation for coefficient of restitution. On my own, for linear impulse force, I can get this much by rearranging the equations: Force = -Vr(e+1) / (1/m1 + 1/m2) I cannot, however, understand the rest. As a side note, I am also currently reading pdfs by Chris Hecker, Baraff, and Brian Vincent Mirtich. All of these sources say pretty much the same thing...I've been reading and re-reading the pertinent parts of these source and am still having difficulty with this.
Why don't alcoholics make good calculus teachers?Because they don't know their limits!Oh come on, Newton wasn't THAT smart...
Advertisement
smells like homework!
I don't know of any courses that would use Physics for Game Developers as a textbook. This seems fully applicable to game development. Unfortunately I'm not going to help because I hate Dynamics. Maths shouldn't have a use! :)

Ofcourse the reason why I hate it is because I can't do it. Mind you that's can't do the sort of Dynamics we have to do, which is extremely hard Dynamics. Now I am waffling so I shall end this post totally unaware of the reason why I started it.
it seems more logical to me when working with collision keep everything in conservation of momentums. You dont need to work with forces at all!
You have this situation:
M1.V1 = M1 . Va + M2 . Vb (linear)
Avoid forces... theyre confusing! If you really need to work with impulses, what do you think in using energy methods?
"Mind you that's can't do the sort of Dynamics we have to do, which is extremely hard Dynamics."


Try being a physics major. Dynamics starts to look real easy once you've taken a few courses in quantum mechanics :) As far as your question shadow12345, I bought the book about a week ago, but haven't gotten a chance to look over it yet. I'll read over the part you're having difficulty deriving and work it out later today (i'll probably have to link it back to you in LaTex, so you can read it easier)
Quote:Original post by shadow12345

J = -vr(e+1) /
(1/m1 + 1/m2 + n * [(r1 x n)/I1] x r + n*[(r2 x n)/I2] x r)

...

Force = -Vr(e+1) / (1/m1 + 1/m2)


Ummm... I1 and I2 are the moments of inertia, right? Is "r1 x n" a cross product - r1 is a scalar isn't it? What's r? Are those * dot products?

Anyway, think of it this way. Mass is to linear movement what Moment of Inertia is to rotation. Force = Mass*Acceleration => Torque = Moment of Inertia * Angular Acceleration etc. Usually helps.

Unfortunately my copy of PFGD is buried somewhere. I'll try and dig it out and see what he says.
[teamonkey] [blog] [tinyminions]
It's not the easiest equation... I've uploaded a file to my website, which hopefully will make it clearer. I left out the final, knarly derivation, partially because I don't have time, and partially because it gets very messy very fast. But once you get to that point it's simple algebra, and so is left as an exercise for the reader. :)

Let me know if there are any mistakes. If you want I'd be happy to work out the full derivation, but it'd be this weekend sometime. If there's enough interest I may clean it up some and submit it to GameDev.
Quote:
It's not the easiest equation... I've uploaded a file [home.nc.rr.com] to my website

I have downloaded it and am looking through it.
edit:
it looks like a very good pdf. I hope you didn't write that just for me, although the date appears to show that you did just that! It's 12:38 am july 12 right now, so I'm not going to read through it extensively tonight, but from a quick peak at the stuff at the end, it looks similar to what I already know or have read, but hopefully I will understand this better. I appreciate it! :)

Quote:
smells like homework!


No.

Quote:
If you really need to work with impulses, what do you think in using energy methods?

I don't entirely understand what you mean by this, although I've implemented something similar using the (almost) conservation of kinetic energy

Quote:
I'll read over the part you're having difficulty deriving and work it out later today (i'll probably have to link it back to you in LaTex, so you can read it easier)


I would appreciate that. I guess I'm looking for the explanation of why the author does things.

Quote:
Ummm... I1 and I2 are the moments of inertia, right?

Yes, and in this equation the moment is only for 2d (note that there is no semblance of a matrix, which is required in 3d)
Quote:
Is "r1 x n" a cross product - r1 is a scalar isn't it?


Yes because the book is showing this for 2D initially but the equations should work for 3D. r1 x n is some arbitrary term the author randomly interchanges with r1 x j (j is the impulsive force, which has a magnitude different than the normalized normal vector n). This is part of the reason I don't understand the equation.

Quote:
What's r?


r is the distance vector from the center of mass to the point of application of the force,

Quote:
Are those * dot products?

Yes
Why don't alcoholics make good calculus teachers?Because they don't know their limits!Oh come on, Newton wasn't THAT smart...
Digging out my copy, I see that the final equation is actually
J = -vr(e+1) /(1/m1 + 1/m2 + n * [(r1 x n)/I1] x r1 + n*[(r2 x n)/I2] x r2)


So r1 and r2 are the vectors from the centre of mass of the objects to the point of collision.

n isn't interchangable with J. n is 'a unit vector along the line of action at the impact point from body 1' while J is the impulse on body 1 (-J on body 2) which acts in the direction of the line of action. In other words, n = J/|J|. So they point in the same direction, and one of the constants somewhere must factor in the magnitude of J. Also, the vector result of r x J will point in the same direction of r x n, but have a different length.

I've not yet gone through it, but that might act as an extra clue?
[teamonkey] [blog] [tinyminions]
Well, yes, that explanation helps. The conundrum I have is that the author defines angular impulse as:


M dt = I (Wa - Wb)

M = torque , I = moment of inertia, Wa = angular velocity after

Subsequently, if you rearrange the equation, the Wa, the angular velocity about this axis after the impact (which we are trying to find) becomes:

Wa = Wb + (r x Jn) / I

where Jn is the impulse force along the direction of the normal.

EDIT:
and, as to not avoid confusion, that is the exact same equation I posted above.
Why don't alcoholics make good calculus teachers?Because they don't know their limits!Oh come on, Newton wasn't THAT smart...

This topic is closed to new replies.

Advertisement