我想在三个js上实现裁剪平面。
我对全局剪裁平面不感兴趣,而是对局部剪裁平面感兴趣。
下面是我使用的代码:
switch(this.data.Axis){
case 'X' :
this.clippingplane = new THREE.Plane(new THREE.Vector3(-1 , 0 , 0) , this.data.Slide) ;
break ;
case 'Y' :
this.clippingplane = new THREE.Plane(new THREE.Vector3(0 , -1 , 0) , this.data.Slide) ;
break ;
case 'Z' :
this.clippingplane = new THREE.Plane(new THREE.Vector3(0 , 0 , -1) , this.data.Slide) ;
break ; }
obj.traverseBreadthFirst(function(node){
if(node instanceof THREE.Mesh){
node.material.clipShadows = true ;
node.material.clippingPlanes = [] ;
node.material.clippingPlanes .push( this.clippingplane );
node.material.needsUpdate = true ;
}
});
这里的问题是javascript返回了一个错误:
%t is undefined
对全局剪裁平面使用相同的代码,在渲染器中设置,效果很好...这里有什么问题?
https://stackoverflow.com/questions/46079724
复制相似问题