# How to converse tangential velocity

## 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[i].Position;

p1Dash = p1 + (contactNormal * (contactDepth));

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 on other sites
So I got around to messing about with this again today and managed to come up with this;

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

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.