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

Scale of InstancedMesh is overwritten #367

Closed
krispya opened this issue Mar 28, 2022 · 2 comments · Fixed by #372
Closed

Scale of InstancedMesh is overwritten #367

krispya opened this issue Mar 28, 2022 · 2 comments · Fixed by #372

Comments

@krispya
Copy link
Member

krispya commented Mar 28, 2022

If a scale is applied to an instanced mesh before use-cannon touches it, use-cannon will overwrite it back to [1, 1, 1].

Here is a simple sandbox example: https://codesandbox.io/s/use-cannon-debug-instance-example-forked-yi6m2y?file=/src/App.js

@bjornstar
Copy link
Member

I don't really understand what's going on here. You change the scale of the three object, but don't change the scale of the physics object. How is this supposed to work? It's still going to be the original scale in the physics engine and it won't match the scale of the three object.

@krispya
Copy link
Member Author

krispya commented Apr 6, 2022

The base use case I have is a gltf that I need to scale down to have it fit in my scene and match the physics body I have defined. This scale gets wiped out by use-cannon currently leaving me with no tools to fit my gltf InstancedMeshes in my scene other than to resize them in Blender and reexport them. Another use case I have is sometimes scaling an InstancedMesh is part of a visual effect I have that I don't want to affect the physics body. For instance, I scale a mesh down to have it "disappear" and then once it is gone I clean up the physics body. This is also impossible currently.

Although you are right, I should enhance the example to actually adjust the physics bodies to match the intended mesh scales. I got lazy. :)

bjornstar added a commit to bjornstar/use-cannon that referenced this issue Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants