Attitude indicator & Magnometer help?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
mooreaa
Posts: 2
Joined: Fri Apr 27, 2007 11:07 am

Attitude indicator & Magnometer help?

Post by mooreaa »

Hello, I am trying to make an attitude indicator and a magnometer visualization and I'm reallly stuck.

I was orignally gonna just build a magnometer by drawing 2d polys and rotating it, but I can't get the 2d stuff to rotate at all. I'm using m_pVideoDriver->setTransform(irr::video::ETS_WORLD, m_pNode->getRelativeTransformation());
m_pNode->setRotation(rot);
m_pVideoDriver->draw2DPolygon(m_position,45.4f,video::SColor(255,220,220,220),18);

but it must be compeltely wrong because I don't know/have a way to associate the polygon with the node.

I dunno if anyone has any ideas on how to make the visualizations.
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

You'll have to do this

Node->setRotation(...);
Node->updateAbsoluteTransformation();
Driver->setTransform(ETS_WORLD, Node->getAbsoluteTransformation());
Driver->draw();
If you don't have anything nice to say, don't say anything at all.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

A few things...
  • Aaron, is that you?
  • When you set the world transform, you almost always want the nodes absolute transformation [the one that converts from object space coordinates to world space coordinates]. You can get that with getAbsoluteTransformation().
  • Setting the world transform only applies when rendering 3d objects. When you call draw2DPolygon it sets the driver up for rendering 2d primitives, and it wipes out whatever transforms you may have set.
I posted some code a while back for doing a compass gui element. You might have a look at that code here.

Travis
Post Reply