THREE.js 将 THREE.planeGeometry 转为 THREE.plane
THREE.js Turn THREE.planeGeometry to THREE.plane
我正在尝试为 localClipping 配置 THREE.plane 的位置,我发现它有点不直观。我有一个想法,是否可以创建一些 planeGeometry,对其进行操作,并将其位置和方向转换为在其位置创建一个 THREE.plane?
这对于配置裁剪平面的位置很有用。
您想从具有 PlaneGeometry
的 Mesh
设置 THREE.Plane
,并且您想要考虑网格的 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 );
three.js r.96
我正在尝试为 localClipping 配置 THREE.plane 的位置,我发现它有点不直观。我有一个想法,是否可以创建一些 planeGeometry,对其进行操作,并将其位置和方向转换为在其位置创建一个 THREE.plane?
这对于配置裁剪平面的位置很有用。
您想从具有 PlaneGeometry
的 Mesh
设置 THREE.Plane
,并且您想要考虑网格的 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 );
three.js r.96