Billboard text is upside down

First thing, I am not a seasoned game developer. I am using game development as a conduit to learn programming.

I am attempting to put the player names above the player's head's. I am using a variation of Shawn Hargreaves solution;

            basicEffect.World = Matrix.CreateConstrainedBillboard(textPosition, textPosition - cameraFront, Vector3.Down, null, null);
basicEffect.View = view;
basicEffect.Projection = projection;

const string message = "hello, world!";
Vector2 textOrigin = spriteFont.MeasureString(message) / 2;
const float textSize = 0.25f;
spriteBatch.Begin(0, null, null, DepthStencilState.DepthRead, RasterizerState.CullNone, basicEffect);
spriteBatch.DrawString(spriteFont, message, Vector2.Zero, Color.White, 0, textOrigin, textSize, 0, 0);
spriteBatch.End();


My game is space based, so I needed the text to rotate on all 3 axes, so I implemented the following;

        foreach (PlayerShip objPlayerShip in objPlayers)
{
Vector3 objTextPosition = objPlayerShip.objShipVector + new Vector3(0, 3, 0);
Vector3 objCameraFront = objManager.objCamera.objCameraPostion;

objBasicEffect.World = Matrix.CreateBillboard(objTextPosition, objCameraFront, objManager.objCamera.objCameraUp, null);
objBasicEffect.View = objManager.objCamera.objViewMatrix;
objBasicEffect.Projection = objManager.objCamera.objProjectionMatrix;

string strText = objPlayerShip.strGUID.ToString();
Vector2 objTextOrgin = objCourierNew.MeasureString(strText) / 2;

spriteBatch.Begin(0, null, null, DepthStencilState.Default, RasterizerState.CullNone, objBasicEffect);
spriteBatch.DrawString(objCourierNew, strText, Vector2.Zero, Color.Green, 0, objTextOrgin, 0.09f, SpriteEffects.None, 0.0f);
spriteBatch.End();

}


It seems to be working, but the text is upside down. How would I flip the text right side up? I know I have to change something in objBasicEffect.World. I try to tweak it, but I just make things worse...

Any help would be appreciated. Linuxx

• My guess would be that you want to pass Vector3.Up instead of Vector3.Down to CreateConstrainedBillboard() – Adam Jan 7 '13 at 0:21
• Well, I exchanged CreateConstrainedBillboard() for CreateBillboard() because it's spherical, as apposed to cylindrical (as you can see from my code). I need the text to be available regardless of the orientation. CreateConstrainedBillboard() would appear "on edge" and not be readable if you were looking at the text from above, or below. – Linuxx Jan 7 '13 at 1:10
• As it appears my text was both upside down, and backwards. I solved this with; spriteBatch.DrawString(objCourierNew, strText, Vector2.Zero, Color.Green, 0, objTextOrgin, 0.09f, SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically, 0.0f); I feel really stupid it was so basic... :-/ Then again, I did learn how to combine enum's! Thanks for your help Adam. – Linuxx Jan 7 '13 at 2:17
• @Linuxx Even if you've solved your own question, you should write an answer and accept it :) – Andrew Russell Jan 7 '13 at 4:40

As it appears my text was both upside down, and backwards. I solved this with;

spriteBatch.DrawString(objCourierNew, strText, Vector2.Zero, Color.Green, 0, objTextOrgin, 0.09f, SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically, 0.0f);


I feel really stupid it was so basic... :-/

Then again, I did learn how to combine enum's!