Exemplo n.º 1
0
 /// <summary>
 /// This function applies a "friction" in a direction orthogonal to the body's axis.
 /// </summary>
 void killOrthogonalVelocity(Body targetBody)
 {
     Vector2 velocity = targetBody.GetLinearVelocity();
     float theta = targetBody.Rotation - (float)Math.PI / 2;
     Vector2 sidewaysAxis = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta));
     targetBody.SetLinearVelocity(sidewaysAxis * Vector2.Dot(sidewaysAxis, velocity));
 }