lo-th / Oimo.js

Lightweight 3d physics engine for javascript
http://lo-th.github.io/Oimo.js
MIT License
3.05k stars 301 forks source link

Importing convex mesh types to a world #104

Open coolcomfort opened 1 year ago

coolcomfort commented 1 year ago

Hello,

I was referencing the test_basic.html and trying to change the ground types to a convex mesh. I loaded in a mesh with GLTFLoader from THREE. I also went ahead and added it to the scene and can visibly see it. I then repurposed some of the pre-existing ground code in attempt to create my own based on the custom mesh. I set the type to convex, and then set the shape to the geometry buffer of my custom GLTF loaded object. Unfortunately I keep getting the same error:

Cannot read properties of undefined (reading 'parent')

  world.add({
    type: "convex",
    shape: collisionWorld.geometry,
    size: [15, 15, 15],
    pos: [0, 0, 0],
    density: 1,
    friction: 1,
    restitution: 1,
    world: world,
  });

Let me know if you are able to assist.

Thanks, coolcomfort