Thanks for the repo! Actually, I’m digging a lot deeper into ammo from articles on bullet and ammo by Blue Magnificient but I’m getting this error
This is how I’m adding gltf and floor, this is the same problem i was encountering before, if we are doing getAttribute(‘position’) for gltf then first i have to do setAttribute(‘position’) like you have done in TeapotGeometry.js - this.setAttribute( ‘position’, new BufferAttribute( vertices, 3 ) ); at line 695
This is how I’m adding
createObjects(){
let tempMesh
//PLANE
tempMesh = this.meshes.push(new THREE.Mesh(new THREE.BoxGeometry(30, 30, 1), new THREE.MeshPhongMaterial({ color: 0xffffff })))
this.meshes[tempMesh - 1].rotation.x = -Math.PI / 2
this.meshes[tempMesh - 1].receiveShadow = true
this.meshes[tempMesh - 1].mass = 0
this.rigidBodies.push(this.meshes[tempMesh - 1])
//head
tempMesh = this.meshes.push(this.headGLTF);
this.meshes[tempMesh - 1].geometry.name = 'hull'
this.meshes[tempMesh - 1].position.set(0, 15, 0)
this.meshes[tempMesh - 1].mass = 1
this.rigidBodies.push(this.meshes[tempMesh - 1])
//PHYSICS SETUP
for (let i in this.meshes) {
this.meshes[i].index = i;
//shadows
this.meshes[i].traverse(function(child) {
if (child.visible == true && child.isMesh) {
child.castShadow = true
child.receiveShadow = true
}
});
this.physics.addMesh(this.meshes[i], this.rigidBodies[i], this.meshes[i].mass)
this.physics.setMeshPosition(this.meshes[i], this.meshes[i].position, this.meshes[i].quaternion, 0)
if (this.meshes[i].visible == true) {
this.scene.add(this.meshes[i])
}
}
}
What I am doing here wrong?