Привет, ребята, я работаю с анимацией kfAnimation от модели Collada. Я хочу, чтобы включать в себя элементы управления трекбол, но когда я я превысить размер стека я не знаю, почему мой код следующийTrackballControls with Collada kfAnimation Three JS
function init() {
initRender();
// Camera
initCamera();
// Scene
initScene();
//controlls
initControls();
initGrid();
loadObjectAnimatedFrames();
window.addEventListener('resize', onWindowResize, false);
}
function loadObjectAnimatedFrames(){
loader = loader.load('sources/crack-animated.dae', function (collada) {
model = collada.scene;
animations = collada.animations;
kfAnimationsLength = animations.length;
//model.scale.x = model.scale.y = model.scale.z = 0.125; // 1/8 scale, modeled in cm
for (var i = 0; i < kfAnimationsLength; ++i) {
var animation = animations[ i ];
var kfAnimation = new THREE.KeyFrameAnimation(animation);
kfAnimation.timeScale = 1;
kfAnimations.push(kfAnimation);
}
start();
animate(lastTimestamp);
scene.add(model);
});
}
function initControls(){
controls = new THREE.TrackballControls(camera);
controls.minDistance = 100;
controls.maxDistance = 1800;
controls.addEventListener('change',render);
}
function animate(timestamp) {
var frameTime = (timestamp - lastTimestamp) * 0.001;
if (progress >= 0 && progress < 48) {
for (var i = 0; i < kfAnimationsLength; ++i) {
kfAnimations[ i ].update(frameTime);
}
} else if (progress >= 48) {
for (var i = 0; i < kfAnimationsLength; ++i) {
kfAnimations[ i ].stop();
}
progress = 0;
start();
}
//pointLight.position.copy(camera.position);
progress += frameTime;
lastTimestamp = timestamp;
render();
}
Я пытался поставить обновление элементов управления в неживой и начать функцию, но я думаю, что потребляли много ресурсов. Также я попытался вставить рендер, но те же результаты.
Благодарим за помощь. Надеюсь, что еще несколько экспериментов могут помочь мне.