cant get default projection matrix for debug view

Aug 1, 2011 at 4:31 PM

ive looked everywhere and i cant find the projection/ view matrix (though im currently using a view of identity)

heres my current matrix:

 

 Matrix proj = Matrix.CreateOrthographicOffCenter(0, ConvertUnits.ToSimUnits(graphics.GraphicsDevice.Viewport.Width),
                                                             ConvertUnits.ToSimUnits(graphics.GraphicsDevice.Viewport.Height), 0, 0f,
                                                             1f);

 

The problem it even get all the debug info to show to the screen (it has an X position of 0 and a Y position of preferredbackbufferheight) i have to increase the x by 800 (my viewport width) and even then the other half of the info is off the screen.

im including a screenshot because i do have another less important question(at least for now)

 

image

why does the bounding box look like that. this is my current object class (still a work in progress, but everything except for the debug is defined there)(also this is only my second day of farseer im still learning)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using FarseerPhysics;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Factories;
using FarseerPhysics.Collision;
using FarseerPhysics.Common;
using FarseerPhysics.Controllers;
using FarseerPhysics.Collision.Shapes;
using FarseerPhysics.DebugViews;

namespace Forever
{
    //enumerations
    [Flags]
    public enum _BODYSTATE_
    {
        _DYNAMIC = 0x0,
        _STATIC = 0x1,
        _KINEMATIC =0x2
    }

    //object class
    public class Object
    {
        //constants
        const float _unit = 64.0f;
        const float _forceFactor = 0.1f;
        const float _defaultMass = 0.0f;
        const float _defaultDensity = 0.0f;
        const float _defaultFriction = 0.0f;
        const float _defaultBounceyness = 0.0f;
        const bool _defaultPhysicsOn = true;
        //static members

        //dynamic members
        //  private:
        //  public:
        public _BODYSTATE_ _bState;
        public Body _thisBody;
        public float _mass;
        public float _density;
        public float _bouncyness;
        public float _friction;
        public bool _physicsOn;
        //methods
        //  private:
        float SetToUnit(float value)
        {
            float val;
            val = value / _unit;
            return val;
        }
        float SetToPixel(float value)
        {
            float val;
            val = value * _unit;
            return val;
        }
        //  public:
        public Object( World world , _BODYSTATE_ BSTATE , float width , float height , Vector2 position , float? density ,
            float? mass , bool? physicsOn , float? friction , float? bouncyness )
        {
            //update the body_state
            _bState = BSTATE;  
            //create the body object
            if (density.HasValue)
            {
                _thisBody = BodyFactory.CreateRectangle(world, width / _unit, height / _unit, density.Value / _unit, position / _unit);
            }
            else
            {
                _thisBody = BodyFactory.CreateRectangle(world, width / _unit, height / _unit, _defaultDensity / _unit, position / _unit);
            }
            ///<section>
            /// Update the body state pending user input            
            if (_bState == _BODYSTATE_._DYNAMIC)
            {
                _thisBody.BodyType = BodyType.Dynamic;
            }
            else
            {
                if (_bState == _BODYSTATE_._STATIC)
                {
                    _thisBody.BodyType = BodyType.Static;
                }
                else
                {
                    if (_bState == _BODYSTATE_._KINEMATIC)
                    {
                        _thisBody.BodyType = BodyType.Kinematic;
                    }
                    else
                    {
                        //throw exception
                        throw new System.ArgumentException("Parameter may Online contain one FLAG of type _BODYSTATE_", "_bState");
                    }
                }
            }
            ///</section>
            /// update other variables
            /// 
            if (mass.HasValue == false)
            {
                mass = _defaultMass;
            }
            _thisBody.Mass = mass.Value / _unit;
            _mass = mass.Value / _unit;
            if (friction.HasValue == false)
            {
                friction = _defaultFriction;
            }
            _thisBody.Friction = friction.Value / _unit;
            _friction = friction.Value / _unit;
            if (bouncyness.HasValue == false)
            {
                bouncyness = _defaultBounceyness;
            }
            _thisBody.Restitution = bouncyness.Value / _unit;
            _bouncyness = bouncyness.Value / _unit;
            if (physicsOn.HasValue==false)
            {
                physicsOn = _defaultPhysicsOn;
            }
            _physicsOn = physicsOn.Value;
        }        
        public Vector2 position
        {
            get
            {
                return new Vector2(_thisBody.Position.X * _unit, _thisBody.Position.Y * _unit);
            }
            set
            {
                try
                {
                    _thisBody.Position = value / _unit ;
                }
                catch
                {
                    throw new System.ArgumentException("Right side operand of '=' must be of type Vector2", "position=value");
                }
            }
        }
        public void Draw(SpriteBatch batch)
        {           
        }        

        //thread functions
    }
    class Box
    {
        const float _unit = 64.0f;
        Fixture[] Fixtures;
        EdgeShape[]  Edges;
        public Box(Vector2 position, float width, float height,ref Body body)
        {
            Edges = new EdgeShape[4];
            Edges[0]=
            Edges[0] = new EdgeShape(new Vector2(position.X * _unit - 16, position.Y * _unit - 16), new Vector2(position.X + 16, position.Y - 16));
            Edges[1] = new EdgeShape(new Vector2(position.X * _unit + 16, position.Y * _unit - 16), new Vector2(position.X + 16, position.Y + 16));
            Edges[2] = new EdgeShape(new Vector2(position.X * _unit + 16, position.Y * _unit + 16), new Vector2(position.X - 16, position.Y + 16));
            Edges[3] = new EdgeShape(new Vector2(position.X * _unit - 16, position.Y * _unit + 16), new Vector2(position.X - 16, position.Y - 16));
            Fixtures = new Fixture[4];
            Fixtures[0] = body.CreateFixture(Edges[0]);
            Fixtures[1] = body.CreateFixture(Edges[1]);
            Fixtures[2] = body.CreateFixture(Edges[2]);
            Fixtures[3] = body.CreateFixture(Edges[3]);
        }

    }
    
}

(also ignore the Box Class meant to delete that)