创建
// 创建几何体对象
const sphereGeometry = new THREE.SphereGeometry(1, 10, 10)
// 创建几何体材质
const sphereMaterial = new THREE.MeshLambertMaterial({ color: 0x00ff00, wireframe: false })
// 生成几何体
const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial)
// 添加到创建中
scene.add(sphere);
方法
- position位置
- rotation旋转
- scale缩放
- translateX
- translateY
- translateZ
赋值
sphere.position = new THREE.Vector3(0,0,0);
sphere.rotation = new THREE.Vector3(0.5 * Math.PI,0,0);
sphere.scale = new THREE.Vector3(2,0,0);
sphere.position.x = 0;
sphere.rotation.x = 0.5 * Math.PI;
sphere.scale.x = 2;
sphere.position.set(0,0,0);
sphere.rotation.set(0.5 * Math.PI,0,0);
sphere.scale.set(2,0,0);