public World(AABB worldAABB, Vec2 gravity, bool doSleep) { this._destructionListener = null; this._boundaryListener = null; this._contactFilter = WorldCallback.DefaultFilter; this._contactListener = null; this._debugDraw = null; this._bodyList = null; this._contactList = null; this._jointList = null; this._bodyCount = 0; this._contactCount = 0; this._jointCount = 0; this._warmStarting = true; this._continuousPhysics = true; this._allowSleep = doSleep; this._gravity = gravity; this._lock = false; this._inv_dt0 = 0f; this._contactManager = new ContactManager(); this._contactManager._world = this; this._broadPhase = new BroadPhase(worldAABB, this._contactManager); BodyDef def = new BodyDef(); this._groundBody = this.CreateBody(def); }
/// <summary> /// Construct a world object. /// </summary> /// <param name="gravity">The world gravity vector.</param> /// <param name="doSleep">Improve performance by not simulating inactive bodies.</param> public World(Vec2 gravity, bool doSleep) { _destructionListener = null; _debugDraw = null; _bodyList = null; _jointList = null; _bodyCount = 0; _jointCount = 0; _warmStarting = true; _continuousPhysics = true; _allowSleep = doSleep; _gravity = gravity; _flags = 0; _inv_dt0 = 0.0f; _contactManager = new ContactManager(); }
/// <summary> /// Sets a drawing routine. Methods on the provided object are called-back to perform drawing on each update. /// </summary> /// <param name="debugDraw"></param> public void SetDebugDraw(DebugDraw debugDraw) { _world.SetDebugDraw(debugDraw); }
/// <summary> /// Initialise debug drawing object (interface between Box2D world and openGL rendering). /// </summary> private void InitDebugDraw() { // Attach display window drawing routine to the box2d world. _debugDraw = new OpenGLDebugDraw(); uint flags = 0; flags += (uint)DebugDraw.DrawFlags.Shape; //flags += (uint)DebugDraw.DrawFlags.Joint; flags += (uint)DebugDraw.DrawFlags.Controller; //flags += (uint)DebugDraw.DrawFlags.CoreShape; //flags += (uint)DebugDraw.DrawFlags.Aabb; //flags += (uint)DebugDraw.DrawFlags.Obb; //flags += (uint)DebugDraw.DrawFlags.Pair; //flags += (uint)DebugDraw.DrawFlags.CenterOfMass; _debugDraw.Flags = (DebugDraw.DrawFlags)flags; }
/// <summary> /// Construct a world object. /// </summary> /// <param name="worldAABB">A bounding box that completely encompasses all your shapes.</param> /// <param name="gravity">The world gravity vector.</param> /// <param name="doSleep">Improve performance by not simulating inactive bodies.</param> public World(AABB worldAABB, Vec2 gravity, bool doSleep) { _destructionListener = null; _boundaryListener = null; _contactFilter = WorldCallback.DefaultFilter; _contactListener = null; _debugDraw = null; _bodyList = null; _contactList = null; _jointList = null; _bodyCount = 0; _contactCount = 0; _jointCount = 0; _warmStarting = true; _continuousPhysics = true; _allowSleep = doSleep; _gravity = gravity; _lock = false; _inv_dt0 = 0.0f; _contactManager = new ContactManager(); _contactManager._world = this; _broadPhase = new BroadPhase(worldAABB, _contactManager); BodyDef bd = new BodyDef(); _groundBody = CreateBody(bd); }
/// <summary> /// Register a routine for debug drawing. The debug draw functions are called /// inside the World.Step method, so make sure your renderer is ready to /// consume draw commands when you call Step(). /// </summary> /// <param name="debugDraw"></param> public void SetDebugDraw(DebugDraw debugDraw) { _debugDraw = debugDraw; }
public void SetDebugDraw(DebugDraw debugDraw) { this._debugDraw = debugDraw; }
public void ClearFlags(DebugDraw.DrawFlags flags) { this._drawFlags &= ~flags; }
public void AppendFlags(DebugDraw.DrawFlags flags) { this._drawFlags |= flags; }