JavaScript Three.js 3D引擎:如何使对象变大20%?
我有一个对象:
planeWall=new THREE.Mesh(new THREE.PlaneGeometry(10,5,1,1), material);
然后我想把它放大,比如说 20%
所以我尝试了:
planeWall.geometry=new THREE.PlaneGeometry(12,6,1,1);
但是失败了,调试器说:
TypeError: Cannot read property 'radius' of null
有没有人有这方面的经验?
I've got an object by:
planeWall=new THREE.Mesh(new THREE.PlaneGeometry(10,5,1,1), material);
Then I want to make it bigger, say, 20%
so I tried:
planeWall.geometry=new THREE.PlaneGeometry(12,6,1,1);
but failed,debugger says:
TypeError: Cannot read property 'radius' of null
Is there anyone has some experience for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
或类似于库卡的答案
这个想法是变换属性(位置,旋转,缩放)是Vector3 实例,以便您可以使用提供的方法轻松转换网格。
or similarly to Kuka's answer
The idea is the transform properties(position,rotation,scale) are Vector3 instances so you can use the methods provided to easily transform your meshes.
尝试planeWall.scale.set(1.2,1.2,1.2);
try
planeWall.scale.set(1.2,1.2,1.2);