using System.Collections; using System.Collections.Generic; using UnityEngine; public class VerletStick { private VerletParticle particleA; private VerletParticle particleB; private float length; public float stiffness = 0.8f; // Add this line public VerletStick(VerletParticle particleA, VerletParticle particleB, float length) { this.particleA = particleA; this.particleB = particleB; this.length = length; } public void UpdateStick() { float currentLength = Vector3.Distance(particleA.position, particleB.position); float difference = length - currentLength; Vector3 direction = (particleB.position - particleA.position).normalized; if (!particleA.isLocked) { particleA.position -= direction * difference * stiffness; // Change this line } if (!particleB.isLocked) { particleB.position += direction * difference * stiffness; // Change this line } } }