Question by
Rusik1985 · Sep 07, 2020 at 09:06 AM ·
physicsrigidbodyconfigurablejoint
Help ConfigurableJoint
Hi, I am making a crane simulator and ran into one problem. For the movement of the hook, I use "ConfigurableJoint" when the hook goes up, everything is fine, but when I release it, it moves with slight jerks. How can I fix this have ideas? Or can you give a link to a lesson?
public class TestPhysics : MonoBehaviour
{
public float limit = 0;
public float speed = 0;
void FixedUpdate()
{
if (Input.GetKey(KeyCode.Y))
{
limit += Time.deltaTime * speed; // also tried "fixedDeltaTime" did not help
gameObject.GetComponent<Rigidbody>().WakeUp();
} else if (Input.GetKey(KeyCode.U))
{
limit -= Time.deltaTime * speed;
gameObject.GetComponent<Rigidbody>().WakeUp();
}
SoftJointLimit s = new SoftJointLimit();
s.limit = limit;
gameObject.GetComponent<ConfigurableJoint>().linearLimit = s;
}
}
Comment