19-08-2023, 07:36 AM
(09-08-2023, 07:05 AM)josemendez Wrote: Hi there,
I'm not sure what you mean by freezing/unfreezing an attachment. Attachments simply constrain the relative position of a rope and a target transform/rigidbody, you could freeze either the rope or the transform/rigidbody.
Could you elaborate a bit more?
kind regards
Code:
public void Disable()
{
//solver.enabled = false;
for (var i = 0; i < _solver.velocities.count; i++)
{
_solver.velocities[i] = Vector4.zero;
_solver.angularVelocities[i] = Vector4.zero;
}
positions.Last().transform.GetComponent<Rigidbody>().isKinematic = true;
}
public void Enable()
{
//solver.enabled = true;
positions.Last().transform.GetComponent<Rigidbody>().isKinematic = false;
}
So I have this code on my rope. I attached a Cube with 4 ropes, in the corners.
When I disable it, I want to the rope rest in position. (positions.Last is the rigidbody attached to the 4 fixedjoint)
1, So I disable all my ropes with this code
2, After it I just set back the positions/rotations to default to all my fixedjoints
3, Enable the rope again
Result -> ropes jumping back
I just want to stay there