Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy colliders export #3683

Open
avaer opened this issue Sep 1, 2022 · 0 comments
Open

Easy colliders export #3683

avaer opened this issue Sep 1, 2022 · 0 comments

Comments

@avaer
Copy link
Contributor

avaer commented Sep 1, 2022

Background

Webaverse uses PhysX for physics, and technically supports all collider types supported by Physx.

Currently two types are exposed as configurable metaversefile physics component settings, implemented in the totum glb type handler: https://github.com/webaverse/totum/blob/main/type_templates/glb.js

The main advantage of doing it this way is that it is trans-format, and should work equally for all formats, regardless of howe or whether they specify physics.

However, this does not play nice with model authorship tools which work with the raw formats, like blender GLB export or USD.

GLTF

On the GLTF side, there are generally two competing but compatible conventions, and I think we should support both.

  1. support the explicit extension OMI_collider: Add OMI_collider omigroup/gltf-extensions#63
  2. use a naming convention on exported meshes, a technique used by Godot and traditional game engines during import: https://docs.godotengine.org/en/stable/tutorials/assets_pipeline/importing_scenes.html#create-collisions-col-convcol-colonly-convcolonly

We can and should support both, with a heirarchy of:

  1. metaversefile physics
  2. collider extension
  3. mesh name

Which is roughly in order of "how inconvenient was it/how far out of the way did the user have to go to do the override".

USD

USD support landed in THREE.js r144: https://threejs.org/examples/?q=usdz#webgl_loader_usdz
And there is already a physics solution for USD: https://graphics.pixar.com/usd/release/wp_rigid_body_physics.html
There seems to be less choice here, and USD is a more entrenched format (being used as the foundation of Pixar, NVidia, and Omniverse work), so we should just follow suit and implement the extension along with the loader.

Task

The easiest win is to make sure that all 3 types of physics definition are supported for the GLB case. When we add the USDZ handler, we should also plug it into the physics engine via the existing extension.

Secondarily, we should think about supporting more than just concave and convex physics -- for example, some developers want to use animated box physics attached to an animated rig, for fast animated physics. I'm looking for feedback on what would work best for folks.

Finally, whatever we implement should be documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant