本文主要记录使用Three.js过程中使用的常用方法:

1. 修改颜色 setStyle

找到物体对应的material,调用方法:

material.color.setStyle('#ca14cb'); // 设置成紫色,支持css颜色值

2. 空值物体的可见 visible

material.visible = false; // 这里最好设置下material的transparent为true

3. 修改宽高 scale

unit.scale.x = width / originWidth;
unit.scale.y = height / originHeight;
unit.scale.z = depth / originDepth;

4. 修改位置信息 position

unit.position.set(x, y, z);

5. 修改旋转角度rotation

unit.rotation.x = rotateX;
unit.rotation.y = rotateY;
unit.rotation.z = rotateZ;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2021-10-23
  • 2021-10-30
  • 2021-09-02
  • 2022-12-23
  • 2022-02-07
猜你喜欢
  • 2021-05-01
  • 2021-11-13
  • 2021-08-08
  • 2021-10-28
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案