Skip to content

new Box3().setFromObject() returns NaN #32

@enheit

Description

@enheit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions