0
3 가지로 움직이는 물체를 스케일하려고합니다. 그러나 그것을 스케일 할 때 물체를 스케일하고 다른 위치로 옮길 것입니다.Three JS - 움직이는 물체를 어떻게 스케일합니까?
나는 그러나 내 개체는 렌더링 애니메이션에 다음 코드에 대해 이동, 객체 객체에 대해 이동하지 않으면이 작동
// initiates the scale transition
function doTriangleScale(intersection){
var tween = new TWEEN.Tween(intersection.object.parent.scale)
.to({
x: scaleSize,
y: scaleSize,
z: scaleSize,
}, scaleEase)
tween.start();
// should have a check if the user is still on the object in question, no time for this now
setTimeout(function(){
doTriangleScaleRevert(intersection);
}, 2000)
}
// triggers the scale revert to default
function doTriangleScaleRevert(intersection) {
var tween = new TWEEN.Tween(intersection.object.parent.scale)
.to({
x: 1,
y: 1,
z: 1
}, scaleEase)
tween.start();
}
의 규모를 설정하려면 다음을 사용
scene.traverse(function (e) {
if (e instanceof THREE.Mesh && e.name != "pyramid") {
e.rotation.x += rotationSpeed;
e.rotation.y += rotationSpeed;
e.rotation.z += rotationSpeed;
if(triangleFloatLeft){
e.position.x += 0.01;
}else{
e.position.x -= 0.01;
}
}
});
저는 중심에서 개체의 크기를 조정할 솔루션을 찾고 있습니다.
감사합니다.
빠른 답변 주셔서 감사합니다. 그래서 정적 인 경우 센터에서 확장하는 이유입니다. 원점도 움직이지 않을 것이기 때문에. 하지만 상자를 움직이면 원점이 움직이지 않을 것입니다. – DennisL