Hello, I found this Script on connecting spring joints on collision and it is working perfectly as needed except the default spring variable is set to “10” when I actually need it to be set to “100”
How can I set the spring variable to “100” when the two object collide ?
bool hasJoint;
void OnCollisionEnter (Collision collision)
{
if (collision.gameObject.GetComponent<Rigidbody>() != null && !hasJoint) {
gameObject.AddComponent<FixedJoint> ();
gameObject.GetComponent<FixedJoint>().connectedBody = collision.rigidbody;
hasJoint = true;
}
}
Thank you!