If I get you right you wanna have a light beam pointing the camera direction ? 
I think you need to scale the direction vector you calculated because If I 
don't mistake getForward returns a normalized one So in fact the light is 
detected at the camera location . Not sure 100% but that is what I think based 
on your code 

Sent from my iPhone

On May 16, 2011, at 6:18 PM, Aneesh Chopra <[email protected]> wrote:

> I appreciate if anyone can help to calculate directionalLight3D
> direction here..
> waiting for response.
> 
> On May 14, 11:09 am, Aneesh Chopra <[email protected]> wrote:
>> Thanks wagster,
>> for your response and support.
>> and I confirm that your understanding it correct on my requirement.
>> In simple words, visually light should remain fixed no matter how and
>> where camera pointing.
>> so, I need to move the light.direction based on camera movement, so
>> end result should look like that light is coming from same direction
>> no matter how camera is placed.
>> it is like, binding light direction with camera position.
>> 
>> I got the Camera direction using suggested call..
>> and now trying to figure out the difference between camera direction
>> and the light direction, but with no success.
>> 
>> I tried it as following:
>> //****************************************
>> // initial light direction
>> dLight.direction = new Vector3D(-1500,-600,-1000);
>> 
>> // in Enterframe event, before view.render() call, I am trying to
>> calculate and set the light direction
>> 
>> var obj:Vector3D = Matrix3DUtils.getForward(camera.transform);
>> trace('obj:'+obj.x+', '+obj.y+', '+obj.z);
>> 
>> dLight.direction = new Vector3D(-1500-obj.x,-600-obj.y,-1000-obj.z);
>> //****************************************
>> 
>> I would truly appreciate if you may lead further to resolve this
>> issue.
>> Thanks
>> 
>> On May 13, 3:23 am, wagster <[email protected]> wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> I'm still figuring out this whole thing, but as far as I can tell you
>>> can get a vector describing the direction that any Object3D (like a
>>> camera) is facing by calling
>> 
>>> Matrix3DUtils.getForward(object.transform);
>> 
>>> That gives you the camera direction, you'll then need to transform
>>> that again with the difference between the camera direction and the
>>> light direction.
>> 
>>> There may be an easier way.
>> 
>>> On May 12, 10:08 pm, Aneesh Chopra <[email protected]> wrote:
>> 
>>>> Hello Everyone,
>> 
>>>> I have a Sphere, a DirectionalLight3D and hoverCamera3D
>> 
>>>> DirectionalLight3D initial direction is set as:
>>>> myDLight.direction =   new Vector3D(-1500,-600,-1000);
>> 
>>>> on arrow keys, I am moving hoverCamera3d Using panAngle & tiltAngle
>>>> properties.
>> 
>>>> Problem is light does not move with camera movement and
>>>> my requirement is to have light dropping from same direction no matter
>>>> of camera position.
>> 
>>>> Please suggest how should I can sync Light direction with camera
>>>> movement using panAngle and tiltAngle
>> 
>>>> Thanks

Reply via email to