Page 1 of 1

Camera to be parent for a light source

PostPosted: Wed Oct 13, 2021 8:52 am
by abzivid
Hi,

Is it possible to bind a light source to a camera; the light then moves in same way as the camera?

I'm interested to know how this may be achieved by manually changing the graph and via scripting.

Many thanks
Aleksandar

Re: Camera to be parent for a light source

PostPosted: Wed Oct 13, 2021 11:51 am
by jobigoud
Hi,
Please test the following "Lookat to Transform" script.
If I understand correctly your goal is to have a light at a fixed position in camera space, so when the camera moves around, the light is always at the same position relative to the camera, correct?

To do this with the attached script (see ORBX):
  • Expand the Position, Target and Up-vector nodes from the camera, and plug them into the Lookat to Transform node.
  • Plug the resulting transform into a Placement node connected to the object.
  • Use another Placement node upstream of the camera transform to position the object relatively to the camera. (Or use the built-in transform on the object if it has one).

lookatToTransform.png


lookatToTransform.lua
(4.6 KiB) Downloaded 236 times


lookatToTransform.orbx
(84.96 KiB) Downloaded 219 times

Re: Camera to be parent for a light source

PostPosted: Thu Oct 14, 2021 8:30 am
by abzivid
Hi,

Many thanks. Having light at fixed position in camera space is indeed what I needed.
Will test the script.