Esempio n. 1
0
        private void UpdatePoints()
        {
            if (Main.gameInactive)
            {
                return;
            }

            for (int i = 0; i < Points.Count; i++)
            {
                VerletPoint point = Points[i];

                Vector2 distance = point.Position - point.OldPosition;
                Vector2 velocity = distance * FRICTION;

                point.OldPosition = point.Position;

                if (!point.Pinned)
                {
                    point.Velocity = velocity;

                    point.Position   += point.Velocity;
                    point.Position.Y += GRAVITY;
                }
            }
        }
Esempio n. 2
0
 public VerletStick(VerletPoint start, VerletPoint end, float length, Texture2D texture = null)
 {
     Start = start;
     End = end;
     Length = length;
     Texture = texture ?? Main.magicPixel;
 }