14-12-2020, 08:20 AM
(This post was last modified: 14-12-2020, 08:22 AM by josemendez.)
(11-12-2020, 06:04 PM)llevine Wrote: Thank you! You can ignore the "when enough force" part. I understand what you're saying, and am guessing I need to implement my own pinhole constraint as a new constraint type. Could you point me in the direction of how to constrain only two translational DOFs? I see in ObiParticleAttachment that the UpdateStaticAttachment method sets solver.angularVelocities[solverIndex] = Vector3.zero. Would changing this value in 1 dimension give me what I want?
It's unfortunately not as simple as setting the angular velocity. Writing new constraints requires you to have some understanding of constrained dynamics. Obi uses eXtended Position-Based Dynamics (XPBD), you can refer to the original XPBD article for the math involved. Equation 18) in this article is the one used to implement constraints:
https://matthias-research.github.io/page...s/XPBD.pdf