本文介绍了Three.js - 从点缩放圆柱体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以从特定点在 Y 轴上增加圆柱体的比例.
Is it possible to increase the scale of a cylinder on the Y-axis from a specific point.
不是圆柱体从原点向上和向下增长到新的比例,而是像条形图一样从顶部向上/向下增长.
As instead of the cylinder growing from its origin up and down to the new scale, growing from the top upwards/downwards only like a bar chart.
当前代码:
function animate() {
render();
cylinder.scale.y += 0.1;
requestAnimationFrame(animate);
}
推荐答案
你可以创建一个中介Object3D
来实现:
You can create a intermediary Object3D
to achieve this:
var cylinder = new THREE.Object3D();
scene.add( cylinder );
var cylinderMesh = new THREE.Mesh(geometry.material);
cylinder.add(cylinderMesh);
cylinderMesh.position.y = 2; // move pivot up
cylinder.scale.y += 0.1;
这篇关于Three.js - 从点缩放圆柱体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!