question

Enrique Elizaga avatar image
0 Likes"
Enrique Elizaga asked Phil BoBo edited

how can i rotate a billboard plane displaying a texture?

I pasted a nice texture on the screen but i want to rotate it depending on a chart value. When i try to (even manually) it doesn't rotate. Is there a way or workaround? I really appreciate your ideas.

FlexSim 17.2.2
billboard
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Phil BoBo avatar image
4 Likes"
Phil BoBo answered Phil BoBo edited

Attached is an example model showing how you can draw a rotated billboard texture.

The model has a Shape object with a Custom Draw trigger that uses the drawshape() command to draw textured planes and fglRotate() for rotation:

  1. double rotation = 135 - max(min(current.Value?, 1), 0) * 270;
  2. double shapeIndex = getshapeindex("fs3d\\General\\Quad.3ds");
  3. double textureIndex = gettextureindex("gauge.png");
  4. double textureIndex2 = gettextureindex("gauge-tip.png");
  5. fglDisable(GL_LIGHTING);
  6. drawobject(view, shapeIndex, textureIndex);
  7. fglTranslate(0.5, 0.5, 0.5);
  8. fglRotate(rotation, 0, 1, 0);
  9. fglTranslate(-0.5, -0.5, -0.5);
  10. fglTranslate(0, -1, 0);
  11. drawobject(view, shapeIndex, textureIndex2);
  12. fglEnable(GL_LIGHTING);

The Shape object has a Value label, which should be a value between 0 and 1. In the example, it sets that value based on the content of the queue. The rotation is set based on that value to create a nice gauge with the images you attached.


gauge2.gif (10.0 MiB)
gauge-example.fsm (72.7 KiB)
· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.