Skip to content

Object is not hide by default and not visible on marker scan #37

@Mr-Bhardwa7

Description

@Mr-Bhardwa7

Hello I'm trying to create a 3D TEXT object which will replace the red cube.

I loaded a font and create a 3D Text and add into the scene but I got 2 issues.

  • Text Size is too big and only visible if I do geometry.center()
  • Text is visible by default and not didn't hide or unhide.

Sample code

const fontLoader = nftAddTJS.getFontLoader();
 fontLoader.load(`./fonts/${fontName}`, (font) => {

 var material = new THREE.MeshStandardMaterial({ color: new THREE.Color(obj.color).convertSRGBToLinear(),  side: THREE.DoubleSide })
 material.transparent = true;

    **// TextGeometry exported from nftAddTJS**
    const geometry = nftAddTJS.createTextGeometry(obj.resource.title, {
                font: font, 
               size: parseInt(obj.resource.size) * 0.000001,  **//ISSUE: Size need to provide in decimal or else it create a large text**
               height: 1,
              curveSegments: 12     
          })
         
         geometry.center() 
                                    
         var mesh = new THREE.Mesh(geometry, material);
         
          mesh.scale.set(obj.scale.x, obj.scale.y, obj.scale.z)
          mesh.rotation.set(obj.rotation.x, obj.rotation.y, obj.rotation.z)

           mesh.position.set(1000, 200, 90)  **// If I change the position from (x:0, y:0, z:0) text is not visible on the canvas** 
           nftAddTJS.add(mesh, '3dText', false)
      })

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions