收藏
回答

微信小程序的xr-frame加载的模型可设置缩放范围吗?

<xr-scene id="xr-scene" ar-system bind:ready="handleReady" bind:ar-ready="handleARReady" bind:ar-error="handleARError">
  <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded">
    <xr-asset-load type="gltf" asset-id="gltf-table"  src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/miku.glb" />
  </xr-assets>
  <xr-env env-data="gz-haixinsha"/>
  <xr-node>
    <xr-node node-id="camera-target" position="0 0 0"></xr-node>
    <xr-node node-id="table-wrap" position="0 0 0">
      <xr-gltf node-id="mesh-gltf-table" model="gltf-table" anim-autoplay position="0 -1 0" rotation="0 180 0" scale="0.08 0.08 0.08"  />
    </xr-node>
    <xr-camera
      position="2 1 2" clear-color="0.925 0.925 0.925 1"
      background="ar" target="camera-target" camera-orbit-control=""
    />
  </xr-node>


  <xr-node node-id="lights">
    <xr-light type="ambient" color="1 1 1" intensity="0.2" />
    <xr-light type="directional" rotation="180 0 0" color="1 1 1" intensity="2" />
  </xr-node>
</xr-scene>


当前加载的模型可以控制缩放大小吗?目前缩放到很小模型就看不到了

回答关注问题邀请回答
收藏

2 个回答

  • Roam
    Roam
    01-09

    改缩放就好,可以参考

    https://github.com/dtysky/xr-frame-demo/tree/master/miniprogram/components/template/xr-template-arPreview

    01-09
    有用
    回复 1
    • 阿巳💫
      阿巳💫
      02-05
      scale缩放支持动态修改吗
      02-05
      回复
  • geeze
    geeze
    2023-12-25
          const camEl = this.scene.getElementById('camera');
          this.camera = camEl.getComponent(wx.getXrFrameSystem().Camera);
          this.cameraCtrl = camEl.getComponent('camera-orbit-control');
          this.cameraCtrl.zoomMax = 2;   // 最大
          this.cameraCtrl.zoomMin = 1;   // 最小 
          this.cameraCtrl.zoomSpeed =  0.5;  // 速度
    
    2023-12-25
    有用
    回复
登录 后发表内容