예제 #1
0
 public ContactManager(World argPool, BroadPhase broadPhase)
 {
     m_contactList = null;
     m_contactCount = 0;
     m_contactFilter = new ContactFilter();
     m_contactListener = null;
     m_broadPhase = broadPhase;
     pool = argPool;
 }
 public override void setupTest(int testNum)
 {
     World w;
     IWorldPool pool = new DefaultWorldPool(50, 50);
     if (testNum == 0) {
         w = new World(new Vec2(0.0f, -10.0f), pool);
     } else {
         w = new World(new Vec2(0, -10), pool, new DynamicTreeFlatNodes());
     }
     world.setupWorld(w);
 }
예제 #3
0
 public override void setupTest(int testNum)
 {
     World w = new World(new Vec2(0, -10));
     world.setupWorld(w);
 }
예제 #4
0
 public void makeDomino(float x, float y, bool horizontal, World world)
 {
     PolygonShape sd = new PolygonShape();
     sd.setAsBox(.5f*dwidth, .5f*dheight);
     FixtureDef fd = new FixtureDef();
     fd.shape = sd;
     fd.density = ddensity;
     BodyDef bd = new BodyDef();
     bd.type = BodyType.DYNAMIC;
     fd.friction = dfriction;
     fd.restitution = 0.65f;
     bd.position = new Vec2(x, y);
     bd.angle = horizontal ? (float) (System.Math.PI/2.0) : 0f;
     Body myBody = getWorld().createBody(bd);
     myBody.createFixture(fd);
 }
예제 #5
0
파일: Body.cs 프로젝트: Nomad1/sharpbox2d
        public Body(BodyDef bd, World world)
        {
            Debug.Assert(bd.position.isValid());
            Debug.Assert(bd.linearVelocity.isValid());
            Debug.Assert(bd.gravityScale >= 0.0f);
            Debug.Assert(bd.angularDamping >= 0.0f);
            Debug.Assert(bd.linearDamping >= 0.0f);

            m_flags = 0;

            if (bd.bullet)
            {
                m_flags |= BodyFlags.Bullet;
            }
            if (bd.fixedRotation)
            {
                m_flags |= BodyFlags.FixedRotation;
            }
            if (bd.allowSleep)
            {
                m_flags |= BodyFlags.AutoSleep;
            }
            if (bd.awake)
            {
                m_flags |= BodyFlags.Awake;
            }
            if (bd.active)
            {
                m_flags |= BodyFlags.Active;
            }

            m_world = world;

            m_xf.p.set(bd.position);
            m_xf.q.set(bd.angle);

            m_sweep.localCenter.setZero();
            m_sweep.c0.set(m_xf.p);
            m_sweep.c.set(m_xf.p);
            m_sweep.a0 = bd.angle;
            m_sweep.a = bd.angle;
            m_sweep.alpha0 = 0.0f;

            m_jointList = null;
            m_contactList = null;
            m_prev = null;
            m_next = null;

            m_linearVelocity.set(bd.linearVelocity);
            m_angularVelocity = bd.angularVelocity;

            m_linearDamping = bd.linearDamping;
            m_angularDamping = bd.angularDamping;
            m_gravityScale = bd.gravityScale;

            m_force.setZero();
            m_torque = 0.0f;

            m_sleepTime = 0.0f;

            m_type = bd.type;

            if (m_type == BodyType.DYNAMIC)
            {
                m_mass = 1f;
                m_invMass = 1f;
            }
            else
            {
                m_mass = 0f;
                m_invMass = 0f;
            }

            m_I = 0.0f;
            m_invI = 0.0f;

            m_userData = bd.userData;

            m_fixtureList = null;
            m_fixtureCount = 0;
        }
예제 #6
0
 public void init(World world, Shape shape, Vec2 velocity)
 {
     this.world = world;
     this.shape = shape;
     this.velocity = velocity;
 }
예제 #7
0
 public virtual void processWorld(World world, long tag)
 {
 }
예제 #8
0
        public void init(World world, bool deserialized)
        {
            m_world = world;
            pointCount = 0;
            stepCount = 0;
            bombSpawning = false;
            model.getDebugDraw().setViewportTransform(camera.getTransform());

            world.setDestructionListener(destructionListener);
            world.setParticleDestructionListener(particleDestructionListener);
            world.setContactListener(this);
            world.setDebugDraw(model.getDebugDraw());
            title = getTestName();
            initTest(deserialized);
        }
예제 #9
0
        public void init(TestbedModel model)
        {
            this.model = model;

            Vec2 gravity = new Vec2(0, -10f);
            m_world = model.getWorldCreator().createWorld(gravity);
            m_world.setParticleGravityScale(0.4f);
            m_world.setParticleDensity(1.2f);
            bomb = null;
            mouseJoint = null;

            mouseTracing = false;
            mouseTracerPosition.setZero();
            mouseTracerVelocity.setZero();

            BodyDef bodyDef = new BodyDef();
            groundBody = m_world.createBody(bodyDef);

            init(m_world, false);
        }
예제 #10
0
 public long getTag(World world)
 {
     return default(long);
 }