The title says it all. I would like to have object that the rangeFinder can't see. This would help me to model real life shiny objects for a ToF sensor in webots. Any suggestions?


1 Answer 1


You can set the visibility of nodes w.r.t. rendering devices (Camera, Lidar, RangeFinder or Viewpoint) using the Supervisor function wb_supervisor_node_set_visibility.

If your robot equipped with the RangeFinder has supervisor functionalities (i.e. the Robot.supervisor field is set to TRUE) you can simply set the objects visibility directly in the robot controller. Otherwise, you might need to add an empty Robot node in your world, with supervisor field set to TRUE, that sets the nodes visibility at the very beginning of the simulation.

Here is a sample python controller to set the visibility that retrieves both the object and RangeFinder nodes using the DEF name:

from controller import Supervisor

supervisor = Supervisor()
range_finder = supervisor.getFromDef("RANGE_FINDER")
hidden_object= supervisor.getFromDef("HIDDEN_OBJECT")
hidden_object.setVisibility(range_finder, False)

Disclaimer: I'm part of the Webots development team.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.