Jump to content
  • Advertisement
Sign in to follow this  
danhoop

verlet collision with differing masses

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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:)

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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:)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!