Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

You can see an example of MovableText being used here.

Since rendering::MovableText inherits from Ogre::MovableObject, you need to attach it to the Ogre::SceneNode of a Gazebo rendering::Visual.

You can see an example of MovableText being used here.

Since rendering::MovableText inherits from Ogre::MovableObject, you need to attach it to the Ogre::SceneNode of a Gazebo rendering::Visual.. Something like this for example:

// Get the user camera
rendering::UserCameraPtr userCamera = gui::get_active_camera();

// Create a visual and add it to the camera's scene
rendering::VisualPtr visual;
visual->Load();
userCamera->GetScene()->AddVisual(visual);

// Create text, Obs: Font size is in meters
rendering::MovableText *text;
text->Load("__TEXT_OBJECT__", "text displayed", "Arial", 0.1);

// Create a node for the text
Ogre::SceneNode *textNode = visual->GetSceneNode()->createChildSceneNode("__TEXT_NODE__");
textNode->attachObject(text);