(15-05-2021, 12:19 PM)josemendez Wrote: This being said, I'm open to implementing this as most of the foundation is already there as you said. It is just a matter of designing an API and exposing it in a convenient way.
Out of curiosity, what would you use this for in your game?
kind regards,
I can't go into too much detail about our project, but one feature we have is climbing. It works great on Unity colliders: We query a volume around the character for a suitable grab point in the desired direction of travel. We use a series of checks (which could be more optimal if we had lower-level access to PhysX) that finds the closest point on a collider to the center of a sphere, if it overlaps with that sphere. The character then animates to that point and the cycle continues.
If a similar query could be done quickly for ropes, it'd allow the character to treat ropes in a similar way. And potentially cloth or soft bodies.
Similarly, we use queries to test whether he should fall, slide (surface is too steep), or remain standing. Also, we use a series of sphere-casts are used to find surfaces that a character should vault onto; if a wall is detected, it checks above to see if there is a surface above the wall to climb upon. In theory there's no reason that the same logic cannot be applied to Obi actors (especially if they are large and heavy enough).
Another use case for queries would be to check if the character is submerged in particle-based liquid and switch to a swimming state.
Another thing that'd be desirable is for bullet projectiles (e.g. hitscan) to impact particles and push them away appropriately depending on the surface normal the projectile impacts. If there are a lot of projectiles flying around every frame, it'd be necessary to prune checks similar to what happens with PhysX queries.
Also, when an explosion occurs, we'd need to check a potentially large volume for particles and apply forces to them.
There's also the stuff mentioned previously, like picking up an individual particle and moving it around. While these are certainly more sparse and don't require knowing the exact nearest surface interesection with a ray, the extra speed and precision would be at least "nice" or open opportunities for more complex manipulations.
Feature parity with PhysX in this sense would basically open up a lot of opportunities to use Obi as a "PhysX for everything PhysX can't do", like soft deformable objects, or complex systems of joints (which often PhysX fails with). Obi has the potential to be used for a lot more than fancy effects: Consider BeamNG, which is basically an elaborate cloth simulation made of particles and constriants. The ultimate goal would be to have a single API for querying and manipulating both the PhysX and Obi universes so the features we develop for PhysX interactions naturally carry over (and show off) Obi.