Hi Andrew,
This is probably because you use normalmaps, and they were mapped/
outputted in a righthanded system app.
Loaded in leftHanded Away, the u values of the uv's are inversed.
Also, the system assumes no light were added during
the normalmap generation, causing extra offset of the colors if it was
the case.
A simple inverse of the map or custom u = 1-u to uv's generation
should correct this.
or place the light at the opposite position you want.
Fabrice
On Mar 14, 2009, at 6:52 PM, zhil wrote:
Hello, everybody!
I have a really confusing problem with light position.
I have a HoverCamera3D and DirectionalLight3D on stage and I am trying
to move light source with the camera.
After spending tons of the time I have founded really weird solution
light.moveTo(camera.x,-camera.z,-camera.y);
(z and y are messed and with - sign).
Results are exactly what I am looking for
http://files.rightinpoint.com/tailor_65s6d562/messed_axises/tailor2.html
When I try more logical solution, like
light.moveTo(camera.x,camera.y,camera.z);
I got weird results like
http://files.rightinpoint.com/tailor_65s6d562/correct_axises/tailor2.html
Full code
function initListeners():void {
addEventListener( Event.ENTER_FRAME, onEnterFrame );
stage.addEventListener(MouseEvent.MOUSE_DOWN,
onMouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
/**
* Navigation and render loop
*/
function onEnterFrame(event:Event):void {
view.camera.moveTo(obj.x,obj.y,obj.z);
view.camera.rotationY=mouseX/2;
view.camera.rotationX=mouseY/2;
view.camera.moveBackward(5);
if (move) {
camera.targetpanangle = 0.3*(stage.mouseX -
lastMouseX) +
lastPanAngle;
camera.targettiltangle = 0.3*(stage.mouseY -
lastMouseY) +
lastTiltAngle;
}
camera.hover();
light.moveTo(camera.x,-camera.z,-camera.y);
trace("");
trace("X:"+camera.x);
trace("y:"+camera.y);
trace("z:"+camera.z);
view.render();
}
/**
* Mouse down listener for navigation
*/
function onMouseDown(event:MouseEvent):void {
lastPanAngle = camera.targetpanangle;
lastTiltAngle = camera.targettiltangle;
lastMouseX = stage.mouseX;
lastMouseY = stage.mouseY;
move = true;
stage.addEventListener(Event.MOUSE_LEAVE,
onStageMouseLeave);
}
/**
* Mouse up listener for navigation
*/
function onMouseUp(event:MouseEvent):void {
move = false;
stage.removeEventListener(Event.MOUSE_LEAVE,
onStageMouseLeave);
}
/**
* Mouse stage leave listener for navigation
*/
function onStageMouseLeave(event:Event):void {
move = false;
stage.removeEventListener(Event.MOUSE_LEAVE,
onStageMouseLeave);
}
}