When I attach a (point) light to the ArcRotateCamera, the position of the light changes.
How can I prevent that, or compensate the change? When loggin, it sais the absolute position didn’t change.
thanks!
When I attach a (point) light to the ArcRotateCamera, the position of the light changes.
How can I prevent that, or compensate the change? When loggin, it sais the absolute position didn’t change.
thanks!
You need to transform the light position by the inverse transform of the camera transformation, so that when the light position will be transformed by the camera transformation once it is parented to the camera, it will end up in the position you want:
Thank you for your answer. This is working in the playground. In my gltf model the light is still jumping position. Could this have something to do with the gltf being exported with flip Z? Because it does look like the light jumped to the back of the model.
How would I fix that with your matrix thing? (I don’t really understand what you did there… but happy to use it of course)
Try setting scene.useRightHandedSystem = true
and see if that fixes the problem.
That fixed some other things… but unfortunately not this issue.
I made a scene and loaded gltf in it. There the matrix calculation is working.
So… must be something in my scene that I can’t find. I will try and rebuild my model.
Thank you for your answers
I suppose the best solution would be to unparent the import from the created root node. Else, if you combine cam and lights from BJS (left-handed) parented to your imported (right-handed) model, you will to have to account the transformation with each change. In short, you would need to choose between right-handed or left-handed and work everything the same. To me, if the model is only a (small) part of the scene (and your lights, cam and animations are done in BJS), it’s easier to just remove the transform node and work the scene from BJS standard. Of course, my opinion only.