- Home /
How do you change the breakforce and break torque of a joint through script.
I am attaching an object through collision by creating a fixed joint. I am able to add the connecting body and toggle preproccesing and collision. But I cannot change the breakforce and torque.
void OnTriggerEnter (Collider other) {
if (other.tag == "Throw") {
gameObject.AddComponent<FixedJoint>();
theJoint = gameObject.GetComponent<FixedJoint>();
theJoint.connectedBody = player.GetComponent<Rigidbody>();//player is the object I am picking up
theJoint.enableCollision = false;
theJoint.enablePreprocessing = false;
theJoint.breakForce = 0.001f;
theJoint.breakTorque = 0.001f;
JointGood = true;
} }
When I remove the breakforce and breaktorque lines the script will work .Any help would be appreciated.
Thanks in advance.
Hi so I have just figured out that when I picked up the object the force at which I was picking it up was too low so the joint broke immediately. So now I need to figure out how to bring the value of the break force and torque after it has been picked up, without breaking the joint. If anyone has any suggestions I would be very grateful!
Your answer
![](https://koobas.hobune.stream/wayback/20220613201358im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Apply force and torque on different collider enter 0 Answers
physx joint clutch 0 Answers
Character Controller meets Rigidbody 1 Answer
Moving a rigid body on a plane applying forces 1 Answer
Why are my collisions adding massive amounts of force? 2 Answers