Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Disable/stop solver?
#3
(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
Reply


Messages In This Thread
Disable/stop solver? - by lacasrac - 02-08-2023, 06:00 PM
RE: Disable/stop solver? - by josemendez - 09-08-2023, 07:05 AM
RE: Disable/stop solver? - by lacasrac - 19-08-2023, 07:36 AM
RE: Disable/stop solver? - by josemendez - 21-08-2023, 06:43 AM
RE: Disable/stop solver? - by lacasrac - 21-08-2023, 08:13 PM