0
$\begingroup$

I would like to draw some text or objects in the 3D view of Webots, how can I do that?

$\endgroup$

1 Answer 1

1
$\begingroup$

There are different techniques depending on what you want to draw:

  • If you just want to add some 2D text, you can do this by using the function: wb_supervisor_set_label. This will allow you to put 2D overlay text in front of the 3D simulation. Please lookup for the Supervisor API documentation.

  • If you want to add a small sub-window in front of the 3D graphics, you should consider using the Display node. This will allow you to do 2D vector graphics and text. This is also useful for example to display processed camera images. Please lookup for the Display node documentation.

  • If you want to add 3D graphics to the main window, this can be done by using the Supervisor API. The Supervisor API can be used to create new nodes - meaning that you can create an IndexedFaceSet or IndexedLineSet and adjust vertex positions or indexing accordingly to create and update the shape you wish to draw in the 3D scene.

$\endgroup$
1
  • $\begingroup$ Another interesting possibility is to use the third technique described here, but to insert 3D objects inside a Billboard node so that they will be attached to the current viewpoint. This is particularly useful if you want to display objects that remains visible regardless of the viewpoint position and orientation. $\endgroup$ Nov 29, 2022 at 12:58

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.