本文介绍了三.js 补间对象到相机前的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 WestLangleys 对另一个问题的回答,我得到了一个对象(几乎)很好地过渡到相机前部:
I've got an object that is tweening (almost) nicely to the front of the camera using WestLangleys answer to another question:
var pLocal = new THREE.Vector3( 0, 0, -10 );
var pWorld = pLocal.applyMatrix4( camera.matrixWorld );
var target = pWorld.sub( camera.position ).normalize();
var tweenMove = new TWEEN.Tween(object.position).to(target, 2000)
我正在努力的下一部分是让物体与相机保持一定的距离(调整 z = -10 没有效果),因为当它完成补间时它会消失(太靠近相机).
The next part I'm struggling with is to get the object to remain a certain distance from the camera (adjusting the z = -10 has no effect), as when it finishes the tween it disappears (too close to camera).
Camera.near 为 1.
Camera.near is 1.
有什么想法吗?
推荐答案
var pLocal = new THREE.Vector3( 0, 0, - 10 );
var target = pLocal.applyMatrix4( camera.matrixWorld );
var tweenMove = new TWEEN.Tween( object.position ).to( target, 2000 );
这篇关于三.js 补间对象到相机前的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!