verlet collision with differing masses

Started by
2 comments, last by Hardwire 16 years, 5 months ago
hey everyone, im working on some physics code based on Thomas Jakobsen's article on advanced character physics. i've implemented the equation he talks about for resolving a collision ...but i was wondering if any of you knew how to make it account for the mass of the 3 points involved in the collision. currently if there is a triangle made of three infinite mass point-masses and a free moving triangle collides with it, his equation moves all the masses, even the infinite ones. any insight would be appreciated - thanks
Advertisement
I suppose you are talking about the case "point x edge". Let's say I have the point's mass in M1 and mass of the edge's endpoints (A and B) is M2A and M2B. I compute M2 as an average mean of M2A and M2B, so (M2A+M2B)/2. Then I compute a vector solving the collision (call it MTD). I change the point's position by adding MTD*M2/(M1+M2). I need to move the edge by -MTD*M1/(M1+M2), so I distribute it between both endpoints using their masses and a "hit coefficient" (it determines the point on the edge which is closest to our "point" mentioned in the first sentence. It is 1 for A and 0 for B). So I simply multiply it by hitCoef*M2B/(M2A+M2B) for the A point and (1-hitCoef)*M2A/(M2A+M2B) for the B point.

I am not sure how precise this is, but it works fine for me :) However I don't have any infinite mass points in my simulation. In the case of one of the points being infinity it should move only the "point" xor the "edge". (M2A+M2B)/2 is still something like infinity if M2A or M2B is infinity:)
i tried something similar to what you suggest...except i did not average the edge's masses and i used the inverse mass of the 3, it never resolved the collision completely.

ill try your method, and let you know how it works out. i don't really care if it accurate, as long as it looks good. thanks!
You don't need to solve the collision "completely" (so the objects don't overlap) as long as you draw your objects filled because noone will be able to notice that:) I realized this when I switched from the "wired" look to "solid" look of my objects:)

This topic is closed to new replies.

Advertisement