Skip to content

案例展示

创建精灵图形

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

<script setup>
import { onMounted } from "vue";

onMounted(() => {
    let TO = new ThingOrigin("fileModel", document.getElementById("TO"), {
        helper: {
            axes: {
                active: true,
            },
            grid: {
                active: true,

            },
        }
    })
    //创建精灵图形
    let SpriteShape = TO.model.initSpriteShape(
        {
            modelName: "spriteShape-" + new Date().getTime(),
            base: {
                positions: [],
                spriteShape: {
                    shape: "sphere", //形状类型 例:'sphere'||'triangle'
                    color: "#f00",
                    radius: 5,
                },
            },
            position: {
                x: 0,
                y: 0,
                z: 0,
            },
            scale: {
                x: 1,
                y: 1,
                z: 1,
            },
            rotation: {
                x: 0,
                y: 0,
                z: 0,
            },
        }
    );
    TO.scene.add(SpriteShape);
})
</script>

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

API 介绍

model.initSpriteShape

方法签名返回值描述
initSpriteShape(modelInfo?: any)Object3D创建精灵图形

参数说明:

参数名类型是否必选描述
modelInfoany模型参数