# Determine if hinge motor reached limit

I need to check if my hinge joint motor reached one if it’s limits and which.

I tried to use HingeJoint.angle and HingeJoint.limits.max/min for this. But my joint angle is not 0 at the beginning of the simulation and is not between the limits (altough the limits work!).

Can anyone help me with this problem?
Thanks

Hi,
I was seaching the same answer and i find this :
hinge.angle

Hope it helps

``````private HingeJoint 		hinge;

void start(){
hinge = GetComponent<HingeJoint> ();
}

void checkAngle(){
if(hinge.angle == hinge.limits.min){
// Do Something
}
}
``````

Hey. If someone is interested… I maged to do that with an invisible trigger that touches the object when it reaches the li its.

Just want to add something that seems to roughly work as well. You can just check against object rotation. Say if you have limits 0 and 30, then your hinge joint reached peak when your rotation (tried it for 2D, so was Z axis in my case) is < -30. This assumes your object starts with 0 rotation in given axis. If this is not true, then just subtract the range of your limits from your initial rotation.

Again example, if your object Z rotation is say 20, with hinge joint limits 0 and 30, then you reached peak for -10 and so on.

Hope it helps.