# I am struggling attaching a Directional Light to an ObjectControls

**URL:** <https://discourse.threejs.org/t/i-am-struggling-attaching-a-directional-light-to-an-objectcontrols/32585>\
**Category:** Questions\
**Tags:** directionalight, objectcontrols\
**Created:** [December 11, 2021, 7:33pm UTC](https://discourse.threejs.org/t/i-am-struggling-attaching-a-directional-light-to-an-objectcontrols/32585 "2021-12-11T19:33:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dugla](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/dugla/32/4044_2.png) [@dugla](https://discourse.threejs.org/u/dugla)\
**Post date:** [December 11, 2021, 7:33pm UTC](https://discourse.threejs.org/t/i-am-struggling-attaching-a-directional-light-to-an-objectcontrols/32585/1 "2021-12-11T19:33:55Z")

</div>

My goal is to attach a set of `DirectionalLights` offset from the `ObjectControls` camera that all move with the camera as it orients around an object. This following approach is not working

I create a light and a helper:  
`const light = new THREE.DirectionalLight( color )`  
`const helper = new THREE.DirectionalLightHelper(light)`

I do **not** add the light to the scene.

I have created an objectControls subclass `cameraLightingRig`. In it’s constructor I attach the light (the light is still in it’s default position and target):

`this.light = light`  
`this.object.add(light)`

the light is now a child of the cameraLightingRig camera (the object property)

I pose the cameraLightingRig camera with this method:

```
setPose(position, target) {

    this.object.lookAt(target)

    const { x, y, z } = position
    this.object.position.set(x, y, z)

    this.object.updateMatrixWorld()

    this.target.copy(target)
    this.update()
};

```

I assume this positions the light at the camera position. Yes or no?  
I have not set the light target. How does happen?

When I run the app the directional light is not at the camera position but rather of to the side.

 ![Screen Shot 2021-12-11 at 2.31.56 PM](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/e/8/e81c2c0c36e240686418ed8efcf037e93559a609.png)

What am I missing here?

---

<div class="post-metadata">

**Author:** ![tfoller](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@tfoller](https://discourse.threejs.org/u/tfoller)\
**Post date:** [December 12, 2021, 5:33am UTC](https://discourse.threejs.org/t/i-am-struggling-attaching-a-directional-light-to-an-objectcontrols/32585/2 "2021-12-12T05:33:11Z")

</div>

You’ll get more help if you provide a minimal editable example of your working code showing the problem, like a fiddle.

In general, you can make direct light follow the camera like this:

[https://jsfiddle.net/tfoller/aujwgq0L/1/](https://jsfiddle.net/tfoller/aujwgq0L/1/)

In fact, since directional light always comes from infinity, you can achieve the same result w/o direct light target, just by setting its position to the difference between the camera and the point it’s orbiting.

[https://jsfiddle.net/tfoller/uvdra7z1/11/](https://jsfiddle.net/tfoller/uvdra7z1/11/)
