缩放Gizmo(THREE.TransformControls)是否可以只有正值? 负值会导致模型由内向外翻转。
答案 0 :(得分:0)
我找到了:转到TransformControls.js和
替换
var newScaleX = oldScale.x * ( 1 + point.x / oldScale.x );
var newScaleY = oldScale.y * ( 1 + point.y / oldScale.y );
var newScaleZ = oldScale.z * ( 1 + point.z / oldScale.z );
point.applyMatrix4( tempMatrix.getInverse( worldRotationMatrix ) );
if ( scope.axis === "X" ) scope.object.scale.x = newScaleX;
if ( scope.axis === "Y" ) scope.object.scale.y = newScaleY;
if ( scope.axis === "Z" ) scope.object.scale.z = newScaleZ;
与
var newScaleX = oldScale.x * ( 1 + point.x / oldScale.x );
var newScaleY = oldScale.y * ( 1 + point.y / oldScale.y );
var newScaleZ = oldScale.z * ( 1 + point.z / oldScale.z );
point.applyMatrix4( tempMatrix.getInverse( worldRotationMatrix ) );
if (newScaleX>0)
if ( scope.axis === "X" ) scope.object.scale.x = newScaleX;
if (newScaleY>0)
if ( scope.axis === "Y" ) scope.object.scale.y = newScaleY;
if (newScaleZ>0)
if ( scope.axis === "Z" ) scope.object.scale.z = newScaleZ;