案例展示
创建 Group
<template>
<div id="TO"></div>
</template>
<script setup>
import { onMounted } from 'vue';
onMounted(() => {
const TO = new ThingOrigin(
'groupTest',
document.getElementById('TO')
);
const group = TO.model.initGroup();
const cylinder = TO.model.initCylinder({
position: {
x: 10,
y: 0,
z: 0
},
material: {
color: 0xff0000
}
});
const cube = TO.model.initCube({
position: {
x: -20,
y: 0,
z: 0
},
material: {
color: 0x0000ff
}
});
group.add(cylinder, cube);
group.position.set(0, 0, 0);
TO.scene.add(group);
TO.controls.initTransform();
TO.controls.setTransformMode(group.name, 'translate');
});
</script>
<style scoped>
#TO {
width: 100%;
height: 400px;
position: relative;
}
</style>
API 介绍
model.initGroup
方法签名 | 返回值 | 描述 |
---|---|---|
initGroup(modelInfo?: modelInfoParams) | Object3D | 创建 Group |
参数说明:
参数名 | 类型 | 是否必选 | 描述 |
---|---|---|---|
modelInfo | modelInfoParams | 否 | 模型参数 |