void Update() { float invStiffness = 1 / (Stiffness * Stiffness); Softbody.SoftBodyUpdate(m_particles, m_constraints, Iterations, invStiffness); Vector3[] vertices = m_mesh.vertices; for (int i = 0; i < vertices.Length; i++) { vertices[i] = m_meshFilter.transform.InverseTransformPoint(m_particles[i].x); } m_mesh.vertices = vertices; }
void Update() { m_particles[0].x = transform.position; float stiffness = 1f / (InvStiffness * InvStiffness); Softbody.SoftBodyUpdate(m_particles, m_constraints, Iteration, stiffness); for (int i = 0; i < numSegments - 1; i++) { float c = 1f;//i / (float)numSegments; Debug.DrawLine(m_particles[i].x, m_particles[i + 1].x, new Color(c, c, c)); } }