- Home /
Rotating hinge joint over 180° with angular limit
When rotating a hinge joint with angular limit it will flip at 180° around the rotation anchor point. On the start object (pentagon) is a script attached.
Update(){
rigidbody.moveRotation(Time.time * 100);
}
Is there a solution to this problem? The the rotation of the start object switches from 180 to -180. It's maybe a direction for a solution
It'd be awfully hacky, but you could make a hinge joint that's the child of another hinge joint object and have the two angles sum to your total angle.
Thx $$anonymous$$arshall for your reply. I kinda get what you want to do but i think the outcome will be the same. But i thought of another solution by reading your suggestion.
The problem is that the hinge joint checks the rotation of the anchored object (start, parent). When that anchored object rotates over 180°, the rotation will become -180° and the joint thinks "my rotation is too far off from my parents, i have to adjust". At this very moment i have to set the joint rotation + or -360°.
I didn't found a way to set the rotation by now. Found this: http://answers.unity3d.com/questions/39797/rotate-a-hinge-at-runtime-using-script.html Gonna check that out later.
When i invert the the joint rigidbody rotation at the time the anchored object switches from 180 to -180 the behavior is wierd. It won't flipe like http://imgur.com/ZBD24rE but the manually adjusted rotation jumps from lets say 137° to -149°. I tried different things. Transform.rotation, Rigidbody.rotation, AddTourque, useLimits, FixedUpdate, Update, rigidbodyType but nothing works well. I guess the joint physics aren't made to to interfere. :'(
I make a lot of usage of joints and handling big angles is a right pest. ages ago, i got this
https://www.assetstore.unity3d.com/en/#!/content/14290
for one problem hinge, its way overkill, but that package is amazingly useful for making all joints work extremely well for exactly this kind of problem (among many others)
Hi dvandamme thanks for the suggestion, looks great. It's really a little bit an overkill for my small project. I try to avoid to have third party content in the project because i had some bad experience with plugins and for example new Unity Version, new Os version, support etc
I just created a empty project and made two objects: parent-rigidbody and the hingeJoint-child then add the rigidbody.roatete script. And guess what, it worked without problems. I will test it tonight in my project again.
Answer by Guliz · Apr 01, 2017 at 02:36 PM
I really don't know what the problem was, but when i created new objects the problem was gone. Maybe it was because the old objects where instances of a prefab but i broke up the relation.
thanks for help and inputs.
Your answer
![](https://koobas.hobune.stream/wayback/20220612113953im_/https://answers.unity.com/themes/thub/images/avi.jpg)