Exemplo n.º 1
0
        public Body(World world, TSVector2?position, FP rotation, object userdata = null)
        {
            this.FixtureList     = new List <Fixture>();
            this.bodyConstraints = new List <IBodyConstraint>();
            this.BodyId          = Body._bodyIdCounter++;
            this._world          = world;
            this.UserData        = userdata;
            this.GravityScale    = 1f;
            this.BodyType        = BodyType.Static;
            this.Enabled         = true;
            this._xf.q.Set(rotation);
            bool hasValue = position.HasValue;

            if (hasValue)
            {
                this._xf.p     = position.Value;
                this._sweep.C0 = this._xf.p;
                this._sweep.C  = this._xf.p;
                this._sweep.A0 = rotation;
                this._sweep.A  = rotation;
            }
            world.AddBody(this);
        }