0

So, I am trying to take a different approach of adding text into the viewer by using HTML. My current approach is that I append the elements to the viewer container, but the problem with that is that the position is absolute. It always sticks to the screen/canvas, so when I move around in the scene, it does not move with it. What I want is for the element to be stuck to the scene, so when the camera moves, it moves along with the scene because it is stuck to it. I have tried the following:

      this.viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_EVENT, function(event){
    console.log(event.target);
    event.target.impl.createOverlayScene('test');
    event.target.impl.addOverlay('test');
    var node = document.createElement("LI");                 // Create a <li> node
    var textnode = document.createTextNode("Water");         // Create a text node
    node.appendChild(textnode);  
                                // Append the text to <li>
    event.target.clientContainer.appendChild(node)


  });

I have messed around with overlay scenes, but it seems they are only for WebGL. So, what is the correct way to add elements to the viewer that share the same scale, and will move around with the camera like the element is part of the scene?

Sam Curry
  • 445
  • 2
  • 11

1 Answers1

0

I have an extensive demo of that approach that you can find at Viewing.Extension.Markup3D. For more details see the article.

Keep in mind that will be a low-perf approach when dealing with a large number of markups compared with using a PointCloud + custom shader:

High-Performance 3D markups with PointCloud in the Forge Viewer

Felipe
  • 4,325
  • 1
  • 14
  • 19