فهرست منبع

Merge pull request #13929 from WestLangley/dev-plane_helper

PlaneHelper: keep front of helper facing direction of normal
Mr.doob 7 سال پیش
والد
کامیت
b5da2405df
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      src/helpers/PlaneHelper.js

+ 3 - 0
src/helpers/PlaneHelper.js

@@ -9,6 +9,7 @@ import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js';
 import { Float32BufferAttribute } from '../core/BufferAttribute.js';
 import { BufferGeometry } from '../core/BufferGeometry.js';
 import { Object3D } from '../core/Object3D.js';
+import { FrontSide, BackSide } from '../constants.js';
 
 function PlaneHelper( plane, size, hex ) {
 
@@ -51,6 +52,8 @@ PlaneHelper.prototype.updateMatrixWorld = function ( force ) {
 
 	this.scale.set( 0.5 * this.size, 0.5 * this.size, scale );
 
+	this.children[ 0 ].material.side = ( scale < 0 ) ? BackSide : FrontSide; // renderer flips side when determinant < 0; flipping not wanted here
+
 	this.lookAt( this.plane.normal );
 
 	Object3D.prototype.updateMatrixWorld.call( this, force );