question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ConvexPolyhedron() has empty vertices and faces arrays when created, and has a vsub error

See original GitHub issue

Once 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:closed
  • Created 3 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
kyleatblackfootcommented, Apr 12, 2020

@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.

0reactions
arpucommented, Apr 17, 2020

ok looks like this is working with BufferGeometry

@kyleatblackfoot https://codesandbox.io/s/trimesh-test-ixvb0

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found