I have setup a hingeJoint on a door that is attached to a bigger item. I have written a little script so when I click on the door it swings open. The problem is when I click on the door it actually lifts up a bit prior to the swing. Could someone please review my settings and give me some insight on what I am doing wrong or what else I need to add.
The code is:
var updateFlag = false;
function FixedUpdate () {
if (updateFlag){
rigidbody.AddForce(0,100,0);
}
}
function OnMouseDown(){
updateFlag = true;
}
function OnMouseUp(){
updateFlag = false;
}
And attached is a .tiff file of the physics settings I have applied.
Thanks again!
– Clint
Maybe you should try uploading the tiff file again. (And possibly save it as apng instead to save on bandwidth)
The .tiff was actually smaller than the png but here is the .png. Sorry about that.
Regards,
– Clint

You are adding the force upwards instead of towards the door, apart from that adding a force might not be the best way to do it here.
You might want to use the hingeJoint’s spring for this. The hingeJoint’s spring takes a targetAngle. Once you have it the spring parameters tuned in the inspector you only have to enable it in the same way as you can click on the checkbox using
hingeJoint.useSpring = true;
Are you talking about the axis I am setting the hingeJoint to flow on?
If I set the axis to 0,0,90 it twists instead of turn out… I think I am a bit confused on this.
Thanks,
– Clint
I am talking about the call to AddForce. AddForce works adds a force upwards in world coordinates. You could apply the force relative to the object:
rigidbody.AddRelativeForce(0, 0, -100);
Ah okay, I gotcha! Thanks…
– Clint