new Box3().setFromObject() returns NaN
enheit opened this issue · 2 comments
enheit commented
When I try to calcualte the boundingBox
for the TextGeometry
using .setFromObject
method it returns an object with NaN
valueses.
const geometry = createGeometry({
text: 'Lorem ipsum',
align: 'left',
width: 2000,
font: font,
});
const material = new RawShaderMaterial(SDFShader({
map: texture,
transparent: true,
color: 0xfffffff,
}))
const mesh = new Mesh(geometry, material);
const box = new Box3();
box.setFromObject(mesh);
console.log(box); // { min: { x: NaN, y: NaN, z: NaN }, max: { x: NaN, y: NaN, z: NaN } }
UPDATE 1:
I found that three-bmfont-text
attribute
uses itemSize = 2. But Box3
expects Vector3
as well as itemSize = 3.
jmatsushita commented
I think this PR solves this issue #5
You can give it a try with yarn add github:kig/three-bmfont-text#vec4-positions