ConvexPolyhedron() has empty vertices and faces arrays when created, and has a vsub error
See original GitHub issueOnce passing a Geometry with verticies and faces to ConvexPolyhedron, the arrays of both get stripped, this breaks the ability to use the ConvexPolyhedron. Another issue is that ConvexGeometry strips the bounding shapes (both box and sphere), not sure if this is causing the error
TypeError: Cannot read property 'vsub' of undefined at Function.ConvexPolyhedron.computeNormal
An example is here https://codesandbox.io/s/convexpolyhedron-test-pjwrr?runonclick=1&file=/src/index.js
To see the issue, toggle the bool on line 58
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
ConvexPolyhedron() has empty vertices and faces arrays ...
Because Cannon expects vertices to be Vec3s where vsub exists as a method. BUT, faces come from ConvexGeometry as a Face3 class, not...
Read more >ConvexPolyhedron | cannon-es
ConvexPolyhedron ({ vertices, faces }) ... Array of integer arrays, describing which vertices that is included in each face. ... body: null |...
Read more >How to create an empty array of structs? - MATLAB Answers
this doesn't work, I get the error, "Subscripted assignment between dissimilar structures." on the first pass through the loop. Instead the only way...
Read more >A Congruence Problem - SIUE
The vertices, edges, and faces of a convex polyhedron P can be defined in terms ... In the definition of our problem, we...
Read more >1993 AIME Problems/Problem 10 - Art of Problem Solving
Problem. Euler's formula states that for a convex polyhedron with $V$ vertices, $E$ edges, and $F$ faces, $V-E+F=2$ . A particular convex polyhedron...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@codynova @stockHuman
I did check use-cannon to see why ConvexPolyhedron worked for an imported GLTF model, where cannon-es fails. I understand that ConvexPolyhedron doesn’t take THREE.Geometry or its raw data.
It’s dawning on me though that shaping the face array can be done before creating the new ConvexPolyherdron and doesn’t have to be done within cannon-es script itself. The reason I initially overlooked this is because use-cannon does this check, whereas cannon-es does not.
So to confirm, ConvexPolyhedron is expecting Vec3 for vertices and and all Face3s converted a multidimensional array before its even passed to ConvexPolyhedron.
I do propose in a feature request in that case, that perhaps in those four methods, that there is a conditional check to make it easier for the end user to use a THREE.Geometry directly by doing these checks inside the script base, how worthwhile that is, perhaps not very much so. Worth the thought though.
ok looks like this is working with BufferGeometry
@kyleatblackfoot https://codesandbox.io/s/trimesh-test-ixvb0