Directional lighting following ofEasyCam

I have a simple 3d model (from ofxAssimpModelLoader) I’d like to light front on, depending on which direction the camera is facing. I had hoped I could just go;

directionalLight.setOrientation(cam.getOrientationEuler());

and then:

cam.enable();
directionalLight.enable();
model.drawFaces();
directionalLight.disable();
cam.disable();

But it seems that this is always on the opposite side of the model. I’m sure there’s an easy fix for this… Can someone show me the light, so to speak?

you can just use a point light and make it follow the camera by parenting them like:

light,setParent(camera)

that way the light will always move with the camera

1 Like

Great! Thanks.