Skip to content

案例展示

创建面板

<template>
  <div id="TO"></div>
</template>

<script setup>
import { onMounted } from 'vue'
let TO = null;
onMounted(() => {
  //初始化场景
  TO = new ThingOrigin("fileModel", document.getElementById("TO"), {
    scene: {//场景
      ground: { //地面
        active: false
      }
    },
  });
  createPlaneHelper();
})

function createPlaneHelper() {
  //创建面板
  let planeHelper = TO.helper.initPlaneHelper(
    {
      position: {//位置
        x: 0,
        y: 120,
        z: 0,
      },
      base: {
        size: 120,//大小
      },
      material: {//材质
        color: "#f00"
      },
    }
  )
  //添加到场景中
  TO.scene.add(planeHelper);
}


</script>

<style scoped>
#TO {
  width: 100%;
  height: 400px;
  position: relative;
}
</style>

API 介绍

helper.initPlaneHelper

方法签名返回值描述
initPlaneHelper(modelInfo?: modelInfoParams)Object3D创建面板

参数说明:

参数名说明类型必填默认值
modelInfo模型参数modelInfoParams--