Change and show geometry color dynamically
Posted: Tue Sep 03, 2019 9:51 am
Hi!
I have a loop in which I'd like to change a color of a geometry (after some conditions are met) and show it in visualizer. So I have something like this:
The output from this code is:
but in visualizer the color is still the same. Is such a use-case possible at all?
I have a loop in which I'd like to change a color of a geometry (after some conditions are met) and show it in visualizer. So I have something like this:
Code: Select all
while (true)
{
...
if (some condition)
{
auto& body = m_model.updBodySet().get("my_fancy_body");
auto& offsetFrame = body.updComponent<PhysicalOffsetFrame>("fancy_offset_frame");
auto& geom = offsetFrame.upd_attached_geometry(0);
std::cout << geom.getName() << " " << geom.getColor() << std::endl;
geom.setColor(Green);
std::cout << geom.getName() << " " << geom.getColor() << std::endl;
}
...
m_model.getVisualizer().show(state);
}
Code: Select all
arm_r_geom_1 ~[1,0.5,0]
arm_r_geom_1 ~[0,1,0]