Here's how I set the object's size (this is in screen space so it is 2d - though the node object is 3d so I set the last value to 1)
[color="#000000"]nodeOrientationBar->setScale(0.2, 0.2 ,1);
Yep it says set scale, but essencially this is size (20% of the screen) because we are in screen space.
[color="#000000"]This resulted in a warped effect that I was originally trying to fix,
To fix I did this:
[color="#000000"]
float width =OgreFramework::getSingletonPtr()->m_pRenderWnd->getWidth(); //This gets me the resolution of the window
float height =OgreFramework::getSingletonPtr()->m_pRenderWnd->getHeight();
resolutionOffset.x=1.0f;
resolutionOffset.y = width/height;
nodeOrientationBar->setScale(0.2 * resolutionOffset.x, 0.2 * resolutionOffset.y,1);
This fixes the issue at 0 rotation...
[color="#000000"]So when I rotate the orientation bar I need to know the math to convert the resolution offset vector to the proper size so that I can properly set the scale.
This is how that's handled currently:
[color="#000000"]
nodeOrientationBar->resetOrientation();
Ogre::Radian rRad = Common::getRoll(playerShip->getOrientation());
nodeOrientationBar->roll(rRad);
[color="#000000"]What i'm looking for is the formula to set the scale properly right after the roll step above. Any help is greatly appreciated (pretty crappy at math I am),
I need the sprite to retain proper dimensions so that it is a equally sized square no matter what resolution and rotation.
thank you