create.octahedron
create.octahedron(props : Object) : Mesh
props - 設定オブジェクト。
- size (Number) : サイズ (デフォルト : 1)。
- detail (Number) : ディテール (デフォルト : 0)。
- position (Array) : 位置 (デフォルト : [0, 0, 0])。
- rotation (Array) : 回転 (デフォルト : [0, 0, 0])。
- option (Object) : オプション (デフォルト : {color: Default.color })。
- material (String | Material | Material[]) : マテリアルタイプ、またはマテリアルオブジェクト、またはマテリアルオブジェクトの配列 (デフォルト :Default.material)。
- castShadow (Boolean) : 別のオブジェクトに影を落とすかどうか (デフォルト : true)。
- receiveShadow (Boolean) : 別のオブジェクトからの影を受けるかどうか (デフォルト : true)。
- doubleSide (Boolean) : 両面表示にするか? (デフォルト : false)。
- upsideDown (Boolean) : 裏面表示にするか? (デフォルト : false)。
- autoAdd (Boolean) : 自動でシーンに追加 (デフォルト : true)。
八面体を作成してシーンに追加します。
detail を増やすことで、さらに多くの面を持つ立体を作成することができます。
コードの例
八面体
const { camera, create, animate } = init()
camera.position.set(0, 2, 2)
create.ambientLight()
create.directionalLight()
const octahedron = create.octahedron()
animate(({ delta }) => {
octahedron.rotation.x += delta;
octahedron.rotation.y += delta;
})
多面体
const { camera, create, animate } = init()
camera.position.set(0, 2, 2)
create.ambientLight()
create.directionalLight()
const octahedron = create.octahedron({
detail: 1,
})
animate(({ delta }) => {
octahedron.rotation.x += delta;
octahedron.rotation.y += delta;
})