我已经做了13年的矢量工作,但仍然在为three.js处理事情的方式而挣扎。所以,我最喜欢做的是用一个扇子来描述,它总是面对着相机,当然,旋转。
这就是我如何在另一种语言中做到这一点的:
// Create a vector facing in camera direction.
temp.x = 0;
temp.y = 1;
temp.z = 0;
vec_rotate(temp, camera.pan);
// Apply vector direction to scene object.
vec_to_angle(entity.pan, temp);
// Rotate scene object's angle around another angle / imaginary line from camera to object.
ang_rotate(
entity.pan,
vector(random(360), 0, 0)
);
因此,在应用entity.lookAt(camera.position)之后,我忽略了基于当前角度的角度旋转(示例的最后一次函数调用)。
发布于 2014-08-31 08:37:16
模拟粉丝的一种方法是这样的:
var fan = new THREE.Mesh( ... );
var pivot = new THREE.Object3D();
scene.add( pivot );
pivot.lookAt( camera.position );
pivot.add( fan );
然后在动画循环中(假设风扇网格在默认情况下面向正z轴),
fan.rotation.z += 0.01;
three.js r.68号
https://stackoverflow.com/questions/25592422
复制相似问题