在 Three.js 中创建一个带圆角的立方体 [英] Creating a cube with rounded corners in Three.js

查看:257
本文介绍了在 Three.js 中创建一个带圆角的立方体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在three.js中创建一个具有自定义半径的圆角的立方体,然后能够用图像对该立方体进行纹理化?

Is it possible to create a cube with rounded corners of custom radius in three.js and then be able to texture that cube with an image?

推荐答案

您可以使用three.js示例中的RoundedBoxGeometry.

You can use RoundedBoxGeometry from the three.js examples.

const geometry = new RoundedBoxGeometry( 10, 10, 10, 6, 2 );

使用如下模式将其导入您的项目:

Import it into your project using a pattern like so:

import { RoundedBoxGeometry } from './threejs/examples/jsm/geometries/RoundedBoxGeometry.js';

three.js r.131

three.js r.131

这篇关于在 Three.js 中创建一个带圆角的立方体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆