moveCamera()

This function moves the camera to a given position.


Parameters:

  • action: "moveCamera"
  • position: object    - position to move the camera to (with x, y and z value)
  • duration: number    - duration (in ms) of the camera movement

Example

<div class="vrxs-embed-wrapper">
  <iframe id="vrxsIframe"
          src="https://viewer.vrxs.de/embedded-model/ModelID?autoplay=true&controls=false&btn_start=false&viewer_api=true"
          frameborder="0" allow="fullscreen" mozallowfullscreen="true" webkitallowfullscreen="true">

  </iframe>
</div>

<script type="text/javascript">
  const iframe = document.getElementById("vrxsIframe").contentWindow;

  function resetView() {
    iframe.postMessage({action: "moveCamera, position: {x: 2, y: 2, z: 2}, duration: 1000}"}, "*");
  }

</script>
<button onclick="moveCamera()">
  Move Camera
</button>