Three.js: Camera rotation to a camera target position

Created on 22 Aug 2011  路  7Comments  路  Source: mrdoob/three.js

Hi
I'm actually wirting a Three.js client of IMML ( http://www.vastpark.org/wiki/1/What_is_IMML ).
And by exemple in my XML that describe my 3D scene I have for a camera :

<Camera Name="LeftCamera" Enabled="False" FOV="60" NearPlane="0.01" FarPlane="1000" Rotation="0.7416796,1.606321,0" Position="-12.24768,14.11299,7.066072" />

And I having some issue at converting the rotation to a vector for my camera.target.position

Any idea ?

Question

All 7 comments

Do you need a target? If not, you can do this:

camera.useTarget = false;
camera.rotation.x = xml_data.rotation.x;
camera.rotation.y = xml_data.rotation.y;
camera.rotation.z = xml_data.rotation.z;

Oh ! thanks for the tips !
This make things easier :) but I still have a problem, I thinks because of left-handed coordonate system that my xml use.

Do you know what I must be aware of to convert to the right-handed ?

l2r

Seems like you just need to invert the z.

What happened to the camera target? I'm trying to use keyboard controls to rotate around an object. I can do this with things like threeX from the three.js boilerplate, or with the trackball controls, but I want constrained movement, only rotating around the Y axis. Is there a way to do this without target?

camera.lookAt( object.position );

Thank you! At the risk of driving you crazy I'll ask one more...any way to constrain the movement of the trackball controls to one or more axis?

You just drove me crazy ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

filharvey picture filharvey  路  3Comments

fuzihaofzh picture fuzihaofzh  路  3Comments

danieljack picture danieljack  路  3Comments

akshaysrin picture akshaysrin  路  3Comments

alexprut picture alexprut  路  3Comments