Threejs剪切网格中包含的对象

时间:2018-04-15 06:31:37

标签: javascript three.js

如何设置剪裁平面,以便在baseObject外部剪切baseObject上的所有子对象?

在这个例子中,childObject应该只显示父对象内的区域,而不显示父对象之外的任何区域。

这是jsfiddle

var geometry = new THREE.PlaneGeometry( 100, 100 );
var material = new THREE.MeshBasicMaterial( {color: 0xffff00, side: THREE.DoubleSide} );
var baseObject = new THREE.Mesh( geometry, material );

var geometry = new THREE.PlaneGeometry( 20, 20 );
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00, side: THREE.DoubleSide} );
var childObject = new THREE.Mesh( geometry, material );

// Set the child object to straddle the baseObject's border.
childObject.position.set(50, 0, 0)

baseObject.add(childObject)

0 个答案:

没有答案