Jump to content
  • Advertisement
Sign in to follow this  
SmellyIrishMan

How to converse tangential velocity

This topic is 3026 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, I'm trying to write a hair simulation program at the moment and have come stuck on a little math problem that I'm hoping someone can help me out with. I want the strands of hair to "slide" over the head so I think I need to keep any tangental velocity of the strand when it collides with the hair. At the moment I'm just moving the strand out of the collision and zeroing it's velocity as so...
p1 = strand.Links.Position; 
 
//Move link out of head and zero movement.  
p1Dash = p1 + (contactNormal * (contactDepth)); 
strand.Links.PhysicsEntity.centerPosition = p1Dash; 
strand.Links.PhysicsEntity.linearVelocity = Vector3.Zero; 
strand.Links.PhysicsEntity.linearMomentum = Vector3.Zero; 
strand.Links.PhysicsEntity.angularVelocity = Vector3.Zero; 
strand.Links.PhysicsEntity.angularMomentum = Vector3.Zero; 
I figure I need to conserve the tangental velocity somehow, but I'm not sure how to go about this (how do I find the appropriate tangent, what do I cross etc...) Here are some diagrams to illustrate the problem. http://img522.imageshack.us/img522/556/physicsquestion.png This picture is what I think I need. I need to send the colliding particle along the collision plane's tangent in order to have it move "around" the object. http://img515.imageshack.us/img515/7173/physicsquestionprograme.png These are some picture of what I have at the moment. In the first slide you can see the bunching of the links as they are just stopped solid. The second slide shows some progress but this progress is very bumpy as the position of the link is simply pushed out at each frame. Finally, the 3rd slide shows the end result by just pushing out the links. Not bad, but it doesn't look good in motion. [Edited by - SmellyIrishMan on April 3, 2010 8:46:00 AM]

Share this post


Link to post
Share on other sites
Advertisement
So I got around to messing about with this again today and managed to come up with this;

originalVelocity = strand.Links.PhysicsEntity.linearVelocity;
normalisedVelocity = new Vector3(originalVelocity.X, originalVelocity.Y, originalVelocity.Z);
normalisedVelocity.Normalize();
strand.Links.PhysicsEntity.linearVelocity = originalVelocity - (contactNormal * Vector3.Dot(contactNormal, normalisedVelocity));
strand.Links.PhysicsEntity.linearVelocity *= 0.9f;

So I'm checking the angle of penetration and removing this from the velocity in order to just get the tangential quantity. The simulation runs a whole lot smoother now anyway, so I'm happy.

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!