Can we attach a light to camera?

Can we attach a light to camera? Like in a cameraNode?

yes. u can since cameraNode extends Node which extens spatial.

And how can you render it? Can we do renderer.draw(cameraNode) ?

ok…maybe im not getting the picture here.

y r u trying to render ur camera? and y would u wanna set a light to the camera?

the camera itself is not a mesh, even if u can attach all the render states to the camera node, there are no actual mesh under that node, so whatever u attach isnt gonna make any differences anyways.

My Spatial objects are under the rootNode.

I have a camera that is not under cameraNode and I have attached light to rootNode.

the light's position is set to the camera's location.

Instead, what I want to do is to create a cameraNode and attach light under that node.
How can I light up spatial objects under the rootNode in this case?

the simple answer is you cant.

the LightState has to be attached to the spatials u wanna light up. If you attach the LightState under rootNode, then all the spatials under root node will get lit up.

OK. Thanks.

I have a different question to you. Can I attach some objects under cameraNode so that the objects always follow the camera?

if u call cameraNode.updateFromCamera() in ur update method, the camera node will be forced to stay with the camera. and whatever u attached to the camera node will move with it.