Hi everyone, im fairly new to Farseer Physics and i'm having trouble with textures. Whenever i try to place the texture over the player body, it seems to be offset randomly for no reason.
The player will always be in the middle of the screen (at the moment), but even when i try to hard code a screen position for the texture it gets offset. These 2 pics will show what i mean. I havent changed any code with the second picture, i've just moved
right along the level.
This is the draw function for the player.
public void Draw(SpriteBatch batch)
Vector2 texOrig = new Vector2(38, 68);
0f, texOrig, // origin of the texture
0.495f, SpriteEffects.None, // width of box is 1.2 meters. texture is 55 pixels wide. to make it 1.2 meters wide in world space: 1.2/55 = 0.1875f
And in case you're wondering where the debug numbers are coming from:
Vector2 temp1 = GameInstance.ConvertScreenToWorld(alien.texPos);
Vector2 temp2 = GameInstance.ConvertWorldToScreen(alien.texPos);
DebugView.DrawString(50, TextLine,"Texture Screen Pos: (" + alien.texPos.X + "," + alien.texPos.Y + ")");
DebugView.DrawString(50, TextLine,"Texture World Pos: (" + temp1.X + "," + temp1.Y + ")");
DebugView.DrawString(50, TextLine,"Texture screen Pos: (" + temp2.X + "," + temp2.Y + ")");
DebugView.DrawString(50, TextLine, "Alien vector: (" + alien.alien.Position.X + "," + (alien.alien.Position.Y - 1.5f) +")");
I have absolutely no idea why the texture is being off set so much, and would greatly appreciate any help on the matter.