## Problem to add physic in a hollow cylinder (threeJS, AmmoJS)

Official Python bindings with a focus on reinforcement learning and robotics.
AleRena19
Posts: 2
Joined: Thu Dec 31, 2020 9:37 am

### Problem to add physic in a hollow cylinder (threeJS, AmmoJS)

Hi all,

I'm pretty new to threeJs and AmmoJs (porting of bullet) world and I don't know if I'm moving totally wrong or I miss something.

I created a hollow cylinder with threeJs using custom shape (CODE) and created the physic with ammoJS using btConvexHullShape and btCompoundShape (CODE), but something went wrong and I don't know how to make it work.

Here is a demo.
https://hollow-cylinder.web.app/home

Anybody can help me?
AleRena19
Posts: 2
Joined: Thu Dec 31, 2020 9:37 am

### Re: Problem to add physic in a hollow cylinder (threeJS, AmmoJS)

UPDATE (05/01/2021)

I update the ammoJS code part like this

Code: Select all

``````const vec31 = new Ammo.btVector3(0, 0, 0);
const vec32 = new Ammo.btVector3(0, 0, 0);
const vec33 = new Ammo.btVector3(0, 0, 0);
const vertices = geometry.vertices;
geometry.faces.forEach(face => {
triangles.push([
{ x: vertices[face.a].x, y: vertices[face.a].y, z: vertices[face.a].z },
{ x: vertices[face.b].x, y: vertices[face.b].y, z: vertices[face.b].z },
{ x: vertices[face.c].x, y: vertices[face.c].y, z: vertices[face.c].z }
]);
});

const shape = new Ammo.btConvexHullShape();
triangles.forEach(triangle => {
vec31.setX(triangle[0].x);
vec31.setY(triangle[0].y);
vec31.setZ(triangle[0].z);