- Home /
How to detect when joint reaches its limits?
I would like to detect when configurable joint reaches its angular limits or goes over them. The thing is that I created a door which uses configurable joint. When door is closed, it is kinematic and when player presses button, the door is set non-kinematic and it opens. Player can push the door if walking against it and door should be set kinematic when it reaches its original (closed) rotation.
Player mass is bigger than door so if player pushes the door over its limits, joint gets all crazy rotations and position. If I could get the limits somehow, I could force the door transform to be at proper position and rotation even when pushed over the limits. I thought this would be easy task but then I realised door eulerangles doesn't get negative values (or values over 360), it's always between 0-360 degrees.