0

I'm creating a scene in A-frame and the physics system is given by ammo driver. I'm trying to import a model 3D (create in Blender) with it's own mesh collision (no a basic primitive like a box or a sphere), but it's that possible? If it is, how can I do it? and If it is not, do you know another modeling program that works? I've trying with Blender, but I don't know if I'm failing in the creation of the mesh or in the import.

Now the ammo-shape that I'm using is a box, but the other options (hull, hacd..) do not work.

    <a-assets>
        <a-asset-item id="car" src="assets/car.gltf"></a-asset-item>
    </a-assets>
    <a-entity position="0 0 -10" gltf-model="#car" rotation="0 90 0"
    ammo-body="type: dynamic; 
    emitCollisionEvents: true;" 
    ammo-shape="type: box;fit: manual; halfExtents: 1.5 2 3.7; offset: 0 0 -0.3"
    ></a-entity>
Ana
  • 1

1 Answers1

0

I don't use A frame that much but if I am not mistaken its build on top of three.js. So to answer some of your questions I would read this (part of 3) first: https://medium.com/@bluemagnificent/intro-to-javascript-3d-physics-using-ammo-js-and-three-js-dd48df81f591

Transcript Quote: "Bullet (ammo.js) supports a large variety of different collision shapes, and it is possible to add your own. For best performance and quality it is important to choose the collision shape that suits your purpose. Some of the collision shapes supported are primitive shapes (e.g box, sphere, cylinder, capsule, cone and multisphere) , compound shapes, triangle mesh, convex hull, static plane and others."

After reading maybe start with the search for "triangle mesh" if that is required for GLTF > ammo.js. And then maybe (gltf as) buffer-geometry attributes versus plain-geometry attributes.

https://discourse.threejs.org/t/how-to-add-ammo-js-physic-to-gltf-file/27539

winnie
  • 26
  • 2