A cloth simulation can give the general movement and can be pined to the ceiling.
But we need a rigid shape for the cable and a curve is good for that.
To make the link between cloth mesh and the curve, we can use empties:
- Empties are parented to the cloth mesh vertices
- And curve vertices are hooked to the empties
Concerning the lamp: empties parented to the mesh vertices won't rotate but simply follow the movement.
So we add a bone:
- The bone has two constraints: one to follow an empty (the rightmost one), the second to track to an empty (the one just before on the right)
- And the lamp mesh is parented to the bone
The cloth mesh
It is a subdivided segment, with a cloth simulation modifier. The leftmost (or more if you need) is in a "pin" vertex group and this group is used as pin group is the cloth simulation.
Mesh extremity / position of the lamp
- Add two empty at a position corresponding to the right extremity, where the lamp will be placed.
- Select one empty, shift select active the mesh
- Enter edit mode
- Select the vertex corresponding to the empty
- Then CtrlP to vertex parent the empty
- Do the same for the second empty
- Add a bone and align it to the position of these two last empties
- Then add two pose mode constraints, so that the bone will follow the empty (copy location) and the bone's tail will target to the other empty (damped track)
At this step, you should already obtain this:
Creating the curve cable
The curve is obtained from the cloth mesh by copying it and convert it to 'curve', so that the curve has the same amount of vertices than the mesh (we'll just remove the rightmost as it corresponds to the lamp).
Now we hook this curve vertices to new empties: CtrlH to hook and ShiftR to repeat on each vertex to the right.
Now link the empties to the mesh/cloth, with the same step we did at the beginning with the empties used for the bone (vertex parenting).
At the beginning below we just scale down the empties and hide the curve in order to facilitate further selections.
- Add a bevel to the curve to make it look like a cable
- Add a subdivision surface to the curve to make it smoother
- Tune the mass of the mesh/cloth (maybe around 1kg) to simulate the lamp weight