在three.js动画中的生涩动画运动 [英] Jerky animated movements in three.js Animation

查看:286
本文介绍了在three.js动画中的生涩动画运动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的three.js场景中的动画和动作有问题。
当我移动相机时(即使是0,0000001%)(通过THREE.TrackballControls或THREE.OrbitControls)或当我使用Tween.js动画对象时,我的动画非常生涩,物体在周围跳动着动物移动轴,看起来像是在位置四舍五入的错误。

Hi i have problem with animation and movement in my three.js scene. When I move my camera (even by 0,0000001%)(by THREE.TrackballControls OR THREE.OrbitControls) or when I animate object using Tween.js, my animation is very jerky, object is jumping durning animatinon around the axis of movement, look like it is error with rounding in position.

问题更大,当我远离场景中心时(senter在顶点(0,0, 0))例如我在顶点(0,8000000,0)并且问题更大。

Problem is bigger, when i move far from scene center (senter is on vertex (0,0,0)) for example I'm on vertex (0,8000000,0) and problem is bigger.

当我移动相机或移动物体时它正在做。

It is doing when I move camera or move object.

我正在使用标准示例代码和标准库:

Im using standard example codes and satndard libraries:

<script src="http://threejs.org/examples/../build/three.min.js"></script>
<script src="js/Detector.js"></script>
<script src="js/TrackballControls.js"></script>
<script src="js/stats.js"></script>
<script src="js/tween.min.js"></script>

我将在这里发布一部分代码,但我不知道代码的哪一部分。 。?

I will be post a part of code here, but i don't know which part of code..?

此处的问题视频:

屏幕视频

编辑:

我尝试移动物体和相机的位置靠近中心(在XYZ:0,0,1000),它的抖动要小得多,但错误仍然非常显着:
视频2在这里

i try to move positions of object and camera close to the center (on XYZ:0,0,1000), it is much less jitter, but error is still remarkable: Video 2 here

推荐答案

我有另一种解决方案,可以在一个巨大的场景中失去精确度。

I have another solution for lose precision for a huge scene.

我决定做出更好的更改相机和物体长距离移动的精度不稳定的问题(例如在坐标XYS(1000000000,165464464665464464,0)处)。

I decide to make better change problem with loose precision for camera and object moving on long distances (for example at coordinates XYS(1000000000,165464464665464464,0)).

我做了一个移动的父对象在与我的船相反的方向。我的船总是在场景位置XYZ(0,0,0),所有其他网格都在一个父对象中,它在我的航班的相反方向上移动(在我的船上移动)。

I made a parent object which is moving in opposite direction than my ship. My ship is always on scene position XYZ(0,0,0) and all other meshes are in a parent object which is moving in opposite direction of my flight (moving around my ship).

当我想移动我的船时,我使用 ship.translateX(10)更改为 parent.translateX(10 * -1)

When i want to move my ship i change using ship.translateX(10) to parent.translateX(10*-1).

效果相同但精确度在无限距离时始终是正确的。此外,我不需要处理相机轨道移动船,我不需要移动天空箱,因为仍然站在我的船在现场位置(我的船不能从天空箱移出)。

Effect the same but precision will be always correct on unlimited distances. Also i dont need to handle with camera orbiting moving ship, and i do not need to move skybox, because of still standing with my ship at the scene position (my ship cant move out from the skybox).

但这意味着我将一个问题改为另一个问题,如何正确计算父箱中的位置和我船的位置。在这里提出另一个问题:

But it is mean that I changed one problem to another, how correctly calculate positions in parent box and positions of my ship. Made another question here:

https://stackoverflow.com/questions/25771604/coordinates-of-objects-in-parent-box-towards-another-parent-box

这篇关于在three.js动画中的生涩动画运动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆