Exemple #1
0
        private void ApplyTriangleForce(ClothPoint cpA, ClothPoint cpB, ClothPoint cpC, Vector3 force)
        {
            var pA          = cpA.GetPosition();
            var pB          = cpB.GetPosition();
            var pC          = cpC.GetPosition();
            var vAB         = pB - pA;
            var vAC         = pC - pA;
            var nABC        = Vector3.Cross(vAB, vAC).Normalized();
            var actualForce = Vector3.Dot(force, nABC) * nABC;

            cpA.ApplyForce(actualForce);
            cpB.ApplyForce(actualForce);
            cpC.ApplyForce(actualForce);
        }
 public ClothSpring(ClothPoint cpA, ClothPoint cpB)
 {
     this.cpA   = cpA;
     this.cpB   = cpB;
     RestLength = (cpB.GetPosition() - cpA.GetPosition()).Length;
 }