Complex objects have return incorrect positions

Topics: User Forum
Jan 24, 2012 at 5:28 AM
Edited Jan 24, 2012 at 5:30 AM

I am a beginner to game programming. I am having an issue where the physics engine seems to return an incorrect position when the object is more complex. If I use a simple shape, such as a circle, rectangle, etc. it works fine. However, if I create a more complex object, like for instance, the physics body for a table, the sprite does not align properly with the physics body.

Code for getting the position of the body, it is simple because of how it is implemented.

 

public override void Update(GameTime gameTime)
        {
            if(shapeType == ShapeType.Simple)
                Position = body.Position * _scale;

            Angle = body.Rotation;
            
        }

Image of what I am talking about