17-11-2021, 02:18 PM
(This post was last modified: 17-11-2021, 02:28 PM by josemendez.)
(17-11-2021, 01:38 PM)spakment Wrote: I'd like to try to get collisions between ArticulationBody and Obi ropes working.
Is it just a matter of replicating the functionality in ObiRigidbody for a new ObiArticulationbody class? I'm guessing I could inherit from ObiRigidbodyBase too and just treat them as rigidbodies, is it only the UpdateVelocities method that's important here?
(I bet I'm missing loads of the hidden complexities!)
thanks in advance
Hi there!
Articulation bodies are very different from rigidbodies. A rigidbody is basically a center of mass, linear/angular velocity, and linear/angular mass. An articulation body however, is a collection of individual bodies defined in their parent's local space, each one with different coordinates/properties depending on the joint configuration. It's not possible to add support for them without diving deep in Obi's physics engine and modifying both backends.
Obi achieves two-way coupling with rigidbodies by applying impulses to them, it does this by:
1) storing their velocities prior to the particle update
2) modifying these velocities according to the impulses applied by the particles
3) then writing the new velocities back (the UpdateVelocities method)
Steps 1) and 3) are trivial and happen outside of the engine's core. Step 2) is where 99% of the stuff takes place.
In an articulation body, applying an impulse involves traversing the entire hierarchy propagating the change in velocity to each individual body. It's not just a matter of modifying a single velocity vector (like it is for rigidbodies). Here's an article that explains it in detail (page 22 onwards): http://www.cs.unc.edu/~lin/COMP768-F07/LEC/20.pdf
Support for articulations will eventually be added to Obi, however it is a quite complex task: making articulation data available to Obi's core laid out in a way that allows for efficient parallel processing, and figuring out a way to apply impulses concurrently to the same articulation body.