819*_*ike 1 javascript linear-algebra plane three.js
我正在尝试为 localClipping 配置 THREE.plane 的位置,但我发现它有点不直观。我有一个想法,是否有可能创建一些 planeGeometry,操纵它,并将它的位置和方向转换为在它的位置创建一个 THREE.plane?
这对于配置剪切平面的位置很有用。
您想THREE.Plane从 aMesh设置 a PlaneGeometry,并且您想考虑网格的position和quaternion(或rotation)。换句话说,您希望THREE.Plane与平面 对齐Mesh。
最简单的方法是使用plane.setFromNormalAndCoplanarPoint().
法线是旋转后平面网格的法线。共面点是平面网格中的任意点;该position会做。
var plane = new THREE.Plane();
var normal = new THREE.Vector3();
var point = new THREE.Vector3();
normal.set( 0, 0, 1 ).applyQuaternion( planeMesh.quaternion );
point.copy( planeMesh.position );
plane.setFromNormalAndCoplanarPoint( normal, point );
Run Code Online (Sandbox Code Playgroud)
三.js r.96
| 归档时间: |
|
| 查看次数: |
937 次 |
| 最近记录: |