그래서이 코드는 사용자가 원하는 치수를 생성하고 사용자 정의 된 new THREE.Geometry()
에 표시합니다. 이것은 대부분의 사람들에게 불만이있을 수 있습니다.Morphing Geometry - Three.Js
- 나는
geometry.morphTargets
를 삽입 할 수있는 방법을 찾을 수 없습니다 :하지만, 이봐, 난내 문제를 three.js를 그냥 새 것으로되어 있어요. 또는 단순히, 나는 그것을 사용하는 방법을 몰라 제대로
그래서 여기 내 코드입니다 : 내가 JSONLoader로드 지오메트리 클래스의 Geometry.morphTargets 배열에 모프 타겟 방법을 검토하는 것이 좋습니다
//custom Object height and width
customHeightWidth(customWidth, customHeight);
function customHeightWidth(width, height){
material = new THREE.MeshBasicMaterial({
map: THREE.ImageUtils.loadTexture(uploadedFile),
side: THREE.DoubleSide,
overdraw: true,
wireframe: false
});
//objects
combined = new THREE.PlaneGeometry(width, height, 30, 10);
geometry = new THREE.Geometry();
geometry.name: "target1", vertices.push(new THREE.Vector3(-(width), height, 0));
geometry.name: "target2", vertices.push(new THREE.Vector3(-(width), -(height), 0));
geometry.name: "target3", vertices.push(new THREE.Vector3( width, -(height), 0));
geometry.computeBoundingSphere();
geometry.faces.push(new THREE.Face3(0, 1, 2));
geometry1 = new THREE.Geometry();
geometry1.vertices.push(new THREE.Vector3(width, height, 0));
geometry1.vertices.push(new THREE.Vector3(-(width), height, 0));
geometry1.vertices.push(new THREE.Vector3( width, -(height), 0));
geometry1.computeBoundingSphere();
geometry1.faces.push(new THREE.Face3(0, 1, 2));
// 1st box
var mesh1 = new THREE.Mesh(geometry);
var mesh2 = new THREE.Mesh(geometry1);
//activating the meshs
THREE.GeometryUtils.merge(combined, mesh1);
THREE.GeometryUtils.merge(combined, mesh2);
mesh = new THREE.Mesh(combined, material);
this.scene.add(mesh);
};
}
var animate = function() {
requestAnimationFrame(animate);
//mesh.rotation.x += 0.01;
//mesh.rotation.y -= 0.006;
renderer.render(scene, camera);
}
init();
animate();
나는 위에 주어진 코드를 사용했으며 슬프게도 나를 위해 일하지 않았다. :(도와주세요. – user3437929
[이 링크] (http://stackoverflow.com/questions/23888333/error-in-morphing-vertices-using-json-loader)를 참조하십시오. 어떻게 든 내 업데이트를 확인할 수 있습니다. 코드. 감사합니다. :) – user3437929