- Home /
How to implement better (more humanlike) joint limits?
I'm trying to create a realistic ragdoll and thus I need a realistic way of modeling human joints. The joints in unity can only be limited by euler angles (x min, x max, y and z). This is fine for robots, but for humans this can result in quite unnatural poses. So I'm looking at reach cones instead, based on this paper: https://pdfs.semanticscholar.org/ee94/ec4b48b7fa35e4b48579a85b226592db4006.pdf
I now have a component that can detect if a configurable joint is within the reach cone or not. However the problem is how to enforce the limit so that the joint can't be outside the reach cone. What I've tried:
Applying torques in a hookes law fashion, spring and damper. => Either too weak or unstable
Forcing the rigidbody to the correct position with MovePosition/MoveRotation. => Stable with one link/rigidbody however unstable with more links attached to eachother in a chain.
Using the limits on the configurable joint by rotating the primary and secondary axis to match the orientation of the current reach cone slice. => After rotating the axis, the angular limits is no longer properly aligned with the axes anymore. (I dont think the joints were designed to be reconfigured during playmode)
I think the reason none of the methods have worked so well is that they are operating outside of the physics solver which to my understanding is doing multiple iterations per fixedstep. Is there a way of telling the solver to handle my constraints somehow/accessing the solver? Or do you have another idea of how I can do this better?
For translational movement we can always create colliders to restrict movement but for rotations we only have joints which only have euler limits, or is there something else that I'm missing?