【发布时间】:2014-06-18 21:35:58
【问题描述】:
我目前正在尝试使用three.js 和cannon.js。
我有一个像这样的对象:
var ship = {
mesh: new THREE.Mesh(); //let's pretend there's a mesh in there.
rigidBody: new CANNON.RigidBody(); //let's pretend there's a rigid body in here.
};
在更新功能上,我将网格旋转到刚体的旋转,如下所示:
var update = function(){
ship.mesh.rotation.x = ship.rigidBody.quaternion.x;
ship.mesh.rotation.y = ship.rigidBody.quaternion.y;
ship.mesh.rotation.z = ship.rigidBody.quaternion.z;
};
这一切都很好,问题是当我定义一个角速度时。
ship.rigidBody.angularVelocity.z = 1; //for example
我认为物体会开始旋转,直到角速度达到 0,但它只是有点前后摇摆。谁能这么好心地解释一下为什么会这样,也许可以给出一个解决方案来保持物体旋转?
【问题讨论】:
标签: angularjs three.js velocity cannon.js