I am trying to scale a THREE.PlaneGeometry with slider events. In effect I am trying to implement a window blind. When I try to change the scale of the geometry with respect to handler, the blind scales uniformly on both sides. It should be fixed at the top and scale in one direction. I tried changing the coordinates of the origin of the Mesh and translating the Mesh by the difference. But it doesn't work. The scaling happens from the origin all the time and the Plane Geometry grows on either side.
Any idea of how I can make it scale on only one side?
You need to translate your geometry so the top edge passes through the origin.
var geometry = new THREE.PlaneGeometry( 10, 10 );
geometry.applyMatrix( new THREE.Matrix4().makeTranslation( 0, - 10 / 2, 0 ) );
Now, when you scale your mesh, the top will remain fixed.
EDIT: There is now a built-in method you can use:
geometry.translate( 0, - 10 / 2, 0 );
three.js r.85
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다