bepu / bepuphysics1

Pure C# 3D real time physics simulation library. Repo contains only the 1.X.X versions.
http://www.bepuphysics.com
Apache License 2.0
402 stars 200 forks source link

Added ellipse swing limit for IK sub-system. #47

Open Silverlan opened 1 year ago

Silverlan commented 1 year ago

Implements a IK swing limit which allows you to specify separate x and y angles.

The implementation is a combination of the IKSwingLimit and the EllipseSwingLimit from the physics sub-system.

I don't quite understand the math behind the calculation of the error value, so I'm not sure if this part is quite correct: https://github.com/Silverlan/bepuphysics1/blob/b276b8a5bb3d66519ed5a2757bcb782c5482d3d6/BEPUik/IKEllipseSwingLimit.cs#L143 I have not noticed any issues in my tests, however.

RossNordby commented 1 year ago

The ellipse swing limit has some iffy behavior in some corner cases which is part of the reason I didn't bring it forward to bepuphysics2, but if it keeps working well across your use cases for a while longer I'll pull this in.