I am trying to understand how up vectors and lookAt () work together in three.js. I set the vector up on this Helper axis, so the Y axis always points to the target geometry, which marks the position of the vector up. It works as expected for X and Y, rotating the axis around the Z axis; and when I try to adjust the Z value of the vector up, I would expect the axes to rotate around the X axis, but nothing will happen.
http://jsfiddle.net/68p5r/4/ [Edit: I added a geo to show the target position.]
I have a dat.gui interface that manipulates the up vector to demonstrate, but the problem exists when I also set the vector manually.
I suspect the problem is with line 74:
zControl.onChange(function(value) { axes.up.set(this.object.x, this.object.y, value); axes.lookAt(new THREE.Vector3(0, 0, 1)); });
When I update the vector up, I instruct axisHelper to update its orientation on the screen by moving its lookAt () down along its Z axis. Changing X and Y works as expected, why not Z?
(This also happens if I use geo instead of axisHelper: http://jsfiddle.net/68p5r/5/ )

meetar
source share