webaverse / app

Web metaverse client
https://app.webaverse.com
MIT License
343 stars 207 forks source link

Fix addConvexGeometry not setting the transform properly. #3717

Closed cyberneticocult closed 1 year ago

cyberneticocult commented 2 years ago

Meshes that were using convexMesh type would have their highlighted mesh in edit mode appear in the wrong location while the actual collision hull in the physics scene would be in the right location.

physicsManager.addConvexGeometry() uses the original mesh passed as a parameter to set the transform. It should be the physicsMesh built by convertMeshToPhysicsMesh() that's used to set the transform.

lalalune commented 2 years ago

ty for this, will review

memelotsqui commented 2 years ago

I do believe that this pr is necessary, as no other collider uses the base mesh position/scale/rotation. They are all using the physics mesh data, and it is indeed fixing when importing hull meshes. The closest example to look at would be addGeometry(mesh), and it is actually using physicsMesh data:

image

Also it will be necessary for the totum omi_collider pr support to work with hulls: https://github.com/webaverse/totum/pull/154