Three.js place an object in rotating camera's fov -


i have fixed-position, perspective camera rotates around 3 axes via keyboard input. @ random intervals, independent of user input, need place objects within camera's field of view no matter direction camera looking. objects need offset specific x , y distances center of camera's fov , offset specific z distance camera's position. cannot use camera.addchild because once object added need move object via tweening independent of camera's movements.

how can done?

you want transform point camera space world space.

in camera's coordinate system, camera located @ origin, , looking down negative z-axis.

place object in front of camera (in camera's coordinate system).

object.position.set( x, y, - z ); // z distance in front of camera, , positive 

now, transform object's position camera space world space:

object.position.applymatrix4( camera.matrixworld ); 

three.js r.69


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -