About direction and postion in directionalLight

I found it will automatic calculate direction and position when directionalLight was initialized by direction. For example:

var light = new BABYLON.DirectionalLight(“DirectionalLight”, new BABYLON.Vector3(1, 4, 1), scene);

calculated direction is {x: 0.23570226039551584, y: 0.9428090415820634, z: 0.23570226039551584},
calculated position is {x: -1, y: -4, z: -1}
Question:
1.How to calculate direction and position?
2.Can I get initial direction by calculated direction and position ?

Hi yang_liu,

I’m not sure I entirely understand the question. The position on directional lights isn’t usually expected to matter, so far as I know, since the light just comes from a direction, not a location. The values you’ve listed are, I believe, set right here in code to be directly related to the value you passed in: the position is arbitrarily set to the inverse of the direction argument, and the direction is just set to the argument. (It’s presumably converted to a unit vector some time later which yields the floating point numbers you’re seeing, but it’s still the same direction.) Is this what you were asking about? If not, please post a Playground if you can; that’ll help me understand better how to help. :smiley:

the position is only usefull for shadows on directionnal lights :slight_smile:

hi @sebavan @syntheticmagus
My team was developing 3D editor with babylonjs, now I use lightGizmo to control direction and position of light, It’s very intuitive to control spotLight and pointLight, but I think it’s very strange about directionalLight, As you can see from this PG, moving position has no effect, you can only see the effect by changing the rotationGizmo.
I found directionalLight was initialized by direction, then, It’s calculated to be a new direction and postion, so I thought it is reasonable that control directionalLight with initial direction, it’s my PG. Am I doing it right?