Tuesday, March 28, 2023
HomeGame Developmentunity - Hinge joint hooked up to spring will get caught

unity – Hinge joint hooked up to spring will get caught


As a result of Hinge Joint 2D parts would not have “spring properties” like their 3D counterparts, I made one. I did this by including a Hinge Joint to attach Bones 1 and a couple of of the tree. I then hooked up a Spring Joint to the circle above the tree, and related this to the second bone. I then utilized angle limits so it swings backwards and forwards between -20 and 20.

enter image description here

This works very properly whenever you apply a one-time pressure to a Inflexible Physique hooked up to Bone 2:

rb.AddTorque(2000f, ForceMode2D.Drive); 

(I do not know why that a lot torque is required to maneuver it although). Nevertheless it does lean after which spring again to the traditional place.

Nonetheless, the minute you add a number of forces inside a short while span (for instance, should you add forces inside Replace()), the tree will simply fall to the left and get caught there.

enter image description here

Even when the forces have stopped being utilized, the tree won’t ever spring again to its unique place, because it does when only one pressure has been utilized.

In this video, you possibly can see the tree being operated first by a motor, then the motor is stopped, inflicting it to spring correctly. After this, a number of forces are utilized one after the opposite and quick succession – which causes it to get caught on the left.

How do I repair this? Any assist could be appreciated.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments