As a result of Hinge Joint 2D parts do not need “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 forwards and backwards between -20 and 20.
This works very nicely once you apply a one-time power to a Inflexible Physique hooked up to Bone 2:
rb.AddTorque(2000f, ForceMode2D.Power);
(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 conventional place.
Nevertheless, the minute you add a number of forces inside a short while span (for instance, in case you add forces inside Replace()), the tree will simply fall to the left and get caught there.
Even when the forces have stopped being utilized, the tree won’t ever spring again to its unique place, because it does when just one power has been utilized.
In this video, you’ll be able to 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 can be appreciated.