Three.js: Keeping object location static with respect to camera

Created on 11 Oct 2011  路  7Comments  路  Source: mrdoob/three.js

Hi,

I am wondering how I could keep an object's location static with regard to the camera.
I.e. I have two objects, one which I want to observe from multiple angles using the trackball camera and another one which should always remain static with regard to the current camera view.

E.g. overlaying a mesh (to be observed from multiple angles using the trackball camera) on an image (static position with regard to trackball camera).

Hope I explained my question alright.

Thanks for any advice :)

Help (please use the forum)

Most helpful comment

Maybe something like this?

object.position.copy( camera.position );
object.rotation.copy( camera.rotation );
object.updateMatrix();
object.translateZ( - 10 );

All 7 comments

Maybe something like this?

object.position.copy( camera.position );
object.rotation.copy( camera.rotation );
object.updateMatrix();
object.translateZ( - 10 );

This works great! I missed the translateZ part. Thanks a million!

Yay! ^^

Hi. What if I want this object spin itself? http://arielbarrios.com/mycube/clean.html shoul use other tecnic

1979

Maybe something like this?

object.position.copy( camera.position );
object.rotation.copy( camera.rotation );
object.updateMatrix();
object.translateZ( - 10 );

For me, this moves the object in the exact opposite direction. Maybe because I'm using camera.lookAt()?

Maybe because I'm using camera.lookAt()?

Hard to tell without seeing your complete code. But please share it not here but at the forum which is the intended place for help requests.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jack-jun picture jack-jun  路  3Comments

fuzihaofzh picture fuzihaofzh  路  3Comments

yqrashawn picture yqrashawn  路  3Comments

akshaysrin picture akshaysrin  路  3Comments

makc picture makc  路  3Comments