Conversion | Matterport SDK
Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.

Index

Methods

Methods

worldToScreen

  • Converts a position of an object in 3d to the pixel coordinate on the screen

    Parameters

    • worldPos: Vector3

      Position of the object

    • cameraPose: Camera.Pose

      The current pose of the Camera as received from Camera.pose.subscribe

    • windowSize: Size

      The current size of the Showcase player

    • Optional result: Vector3

      An optional, pre-allocated Vector3 to store the result

      var showcase = document.getElementById('showcaseIframe');
      var showcaseSize = {
       w: showcase.clientWidth,
       h: showcase.clientHeight,
      };
      var cameraPose; // get pose using: mpSdk.Camera.pose.subscribe
      var mattertag; // get a mattertag from the collection using: mpSdk.Mattertag.getData
      
      var screenCoordinate = mpSdk.Conversion.worldToScreen(mattertag.anchorPosition, cameraPose, showcaseSize)
      

    Returns Vector3