diff --git a/examples/standalone/light_control/light_control.cc b/examples/standalone/light_control/light_control.cc index 329a05862f..1d4abc3341 100644 --- a/examples/standalone/light_control/light_control.cc +++ b/examples/standalone/light_control/light_control.cc @@ -53,6 +53,7 @@ void createLight() entityFactoryRequest.mutable_light()->set_name("point"); entityFactoryRequest.mutable_light()->set_range(4); + entityFactoryRequest.mutable_light()->set_intensity(1); entityFactoryRequest.mutable_light()->set_attenuation_linear(0.5); entityFactoryRequest.mutable_light()->set_attenuation_constant(0.2); entityFactoryRequest.mutable_light()->set_attenuation_quadratic(0.01); @@ -149,6 +150,7 @@ int main(int argc, char **argv) //! [modify light] lightRequest.set_name("point"); lightRequest.set_range(4); + lightRequest.set_intensity(1); lightRequest.set_attenuation_linear(0.5); lightRequest.set_attenuation_constant(0.2); lightRequest.set_attenuation_quadratic(0.01); diff --git a/tutorials/light_config.md b/tutorials/light_config.md index eea79a3237..7d6d906386 100644 --- a/tutorials/light_config.md +++ b/tutorials/light_config.md @@ -7,17 +7,20 @@ This service will allow to modify lights in the scene. To modify lights inside the scene we need to use the service `/world//light_config` and fill the message [`gz::msgs::Light`](https://gazebosim.org/api/msgs/9/classgz_1_1msgs_1_1Light.html). -In particular this example modifies the point light that we introduced with the function `createLight()`. + +This tutorial describes the code in the `examples/standalone/light_control` example. + +First we create a point light with the function `createLight()`: \snippet examples/standalone/light_control/light_control.cc create light **NOTE:**: You can check the [entity creation](entity_creation.html) tutorial to learn how to include models and lights in the scene. -As you can see in the snippet we modify the specular and diffuse colors of the light in the scene. +As you can see in the snippet below, we then modify the specular and diffuse colors of the point light in the scene. \snippet examples/standalone/light_control/light_control.cc modify light -In this case we are creating random numbers to fill the diffuse and specular. +The `r`, `g`, `b` components of the light diffuse and specular colors are randomly generated and constantly changing: \snippet examples/standalone/light_control/light_control.cc random numbers