Daniel
Daniel

Reputation: 3

THREE.js Mesh is not filling BoxHelper

I'm not sure how to get my THREE.Mesh to cover all six sides of my THREE.BoxHelper. For some reason only three triangles are appearing on three of the sides. It seems to be using only 8 vertices. How do I connect all of the vertices? The larger outlined black box is a THREE.BoxHelper on it's own without any THREE.Mesh added. (The object below is a THREE.OBJLoader that I simply want the box outline of). Thank you in advance for any insight!

let box = new THREE.BoxHelper(object, 0xff0000);
let material = new THREE.MeshBasicMaterial({
    color: 0xff0000,
    side: THREE.DoubleSide
});
let mesh = new THREE.Mesh(box.geometry, material);
scene.add(mesh);

Animated GIF of the BoxHelper with three triangles

Upvotes: 0

Views: 702

Answers (1)

Mugen87
Mugen87

Reputation: 31036

The geometry of THREE.BoxHelper is intended for THREE.LineSegments. You are trying to render with this geometry a THREE.Mesh. Since both objects use different primitives for rendering (LINES vs.TRIANGLES), you don't get the desired output.

Upvotes: 2

Related Questions