コード例 #1
0
        public Body(World world, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userdata = null)
        {
            FixtureList = new List <Fixture>();
            BodyId      = _bodyIdCounter++;

            _world           = world;
            _enabled         = true;
            _awake           = true;
            _sleepingAllowed = true;

            UserData     = userdata;
            GravityScale = 1.0f;
            BodyType     = bodyType;

            _xf.q.Set(rotation);

            //FPE: optimization
            if (position != Vector2.Zero)
            {
                _xf.p     = position;
                _sweep.C0 = _xf.p;
                _sweep.C  = _xf.p;
            }

            //FPE: optimization
            if (rotation != 0)
            {
                _sweep.A0 = rotation;
                _sweep.A  = rotation;
            }

            world.AddBody(this); //FPE note: bodies can't live without a World
        }
コード例 #2
0
        public Body(World world, Vector2?position = null, float rotation = 0, object userdata = null)
        {
            FixtureList = new List <Fixture>();
            BodyId      = _bodyIdCounter++;
            World       = world;

            UserData     = userdata;
            GravityScale = 1.0f;
            AppendFlags(BodyFlags.AutoSleep);

#if !USE_AWAKE_BODY_SET
            Awake = true;
#endif
            BodyType = BodyType.Static;
            Enabled  = true;

            Xf.q.Set(rotation);

            if (position.HasValue)
            {
                Xf.p     = position.Value;
                Sweep.C0 = Xf.p;
                Sweep.C  = Xf.p;
                Sweep.A0 = rotation;
                Sweep.A  = rotation;
            }

            world.AddBody(this);
        }
コード例 #3
0
ファイル: Body.cs プロジェクト: hannomalie/hdm-silhouette
        public Body(World world)
        {
            FixtureList = new List <Fixture>(32);

            World = world;

            FixedRotation   = false;
            IsBullet        = false;
            SleepingAllowed = true;
            Awake           = true;
            BodyType        = BodyType.Static;
            Active          = true;

            Xf.R.Set(0);

            world.AddBody(this);
        }
コード例 #4
0
ファイル: Body.cs プロジェクト: liserdarts/XamlPhysics
        public Body(World world, Object userData)
        {
            FixtureList = new List <Fixture>(32);

            World    = world;
            UserData = userData;

            FixedRotation   = false;
            IsBullet        = false;
            SleepingAllowed = true;
            Awake           = true;
            BodyType        = BodyType.Static;
            Enabled         = true;

            Xf.R.Set(0);

            world.AddBody(this);
        }
コード例 #5
0
        public Body Clone()
        {
            Body body = new Body();

            body.World                   = World;
            body.UserData                = UserData;
            body.LinearDamping           = LinearDamping;
            body.LinearVelocityInternal  = LinearVelocityInternal;
            body.AngularDamping          = AngularDamping;
            body.AngularVelocityInternal = AngularVelocityInternal;
            body.Position                = Position;
            body.Rotation                = Rotation;
            body._bodyType               = _bodyType;
            body.Flags                   = Flags;

            World.AddBody(body);

            return(body);
        }
コード例 #6
0
        public Body(World world, PressPlay.FFWD.Components.Collider userData)
        {
            FixtureList = new List <Fixture>(32);
            BodyId      = _bodyIdCounter++;

            World    = world;
            UserData = userData;

            FixedRotation   = false;
            IsBullet        = false;
            SleepingAllowed = true;
            Awake           = true;
            BodyType        = BodyType.Static;
            Enabled         = true;

            Xf.R.Set(0);

            world.AddBody(this);
        }
コード例 #7
0
ファイル: Body.cs プロジェクト: raycrasher/duality
        public Body(World world, object userData)
        {
            this.FixtureList = new List <Fixture>(32);
            this.BodyId      = _bodyIdCounter++;

            this.World    = world;
            this.UserData = userData;

            this.FixedRotation   = false;
            this.IsBullet        = false;
            this.SleepingAllowed = true;
            this.Awake           = true;
            this.BodyType        = BodyType.Static;
            this.Enabled         = true;

            this.Xf.R.Set(0);

            world.AddBody(this);
        }
コード例 #8
0
        public Body(World world, DebugMaterial userData)
        {
            JointList   = new List <Joint>();
            FixtureList = new List <Fixture>(32);
            BodyId      = _bodyIdCounter++;

            World    = world;
            UserData = userData;

            FixedRotation   = false;
            IsBullet        = false;
            SleepingAllowed = true;
            Awake           = true;
            BodyType        = BodyType.Static;
            Enabled         = true;

            Xf.R.Set(0);

            world.AddBody(this);
        }
コード例 #9
0
ファイル: Body.cs プロジェクト: kyallbarrows/Cinch2D_4.3
        public Body(World world, object userData)
        {
            FixtureList = new List <Fixture>(32);
            BodyId      = _bodyIdCounter++;

            World    = world;
            UserData = userData;

            FixedRotation   = false;
            IsBullet        = false;
            SleepingAllowed = true;
#if !USE_AWAKE_BODY_SET
            Awake = true;
#endif
            BodyType = BodyType.Static;
            Enabled  = true;

            Xf.R.Set(0);

            world.AddBody(this);
        }
コード例 #10
0
        public Body(World world, Vector2?position = null, float rotation = 0, object userdata = null)
        {
            FixtureList = new List <Fixture>();
            _world      = world;

            UserData     = userdata;
            GravityScale = 1.0f;
            BodyType     = BodyType.Static;
            Enabled      = true; //FPE note: Also creates proxies in the broadphase

            _xf.q.Set(rotation);

            if (position.HasValue)
            {
                _xf.p     = position.Value;
                _sweep.C0 = _xf.p;
                _sweep.C  = _xf.p;
                _sweep.A0 = rotation;
                _sweep.A  = rotation;
            }

            world.AddBody(this); //FPE note: bodies can't live without a World
        }
コード例 #11
0
ファイル: Serializer.cs プロジェクト: guozanhua/KinectRagdoll
        public void PopulateWorld(World w) {


            foreach (Body b in bodyList) {
                
                b.setWorld(w);

                foreach (Fixture f in b.FixtureList)
                {
                    f.Shape.ComputeProperties();
                    w.FixtureAdded(f);
                }

                float mass = b.Mass;
                //b.ResetMassData();
                b.Mass = mass;
                b.Enabled = true;
                b.Awake = true;
                w.AddBody(b); 
                //w.BodyList.Add(b);
            }

            w.ProcessChanges();

            foreach (Joint j in jointList)
            {
                w.AddJoint(j);
            }

            w.ProcessChanges();

        }
コード例 #12
0
ファイル: Body.cs プロジェクト: BraveSirAndrew/farseerduality
        public Body(World world, object userData)
        {
            FixtureList = new List<Fixture>(32);
            BodyId = _bodyIdCounter++;

            World = world;
            UserData = userData;

            FixedRotation = false;
            IsBullet = false;
            SleepingAllowed = true;
            Awake = true;
            BodyType = BodyType.Static;
            Enabled = true;

            Xf.R.Set(0);

            world.AddBody(this);
        }
コード例 #13
0
ファイル: Body.cs プロジェクト: Alexz18z35z/Gibbo2D
        public Body(World world, Vector2? position = null, float rotation = 0, object userdata = null)
        {
            FixtureList = new List<Fixture>();
            _world = world;

            UserData = userdata;
            GravityScale = 1.0f;
            BodyType = BodyType.Static;
            Enabled = true; //FPE note: Also creates proxies in the broadphase

            _xf.q.Set(rotation);

            if (position.HasValue)
            {
                _xf.p = position.Value;
                _sweep.C0 = _xf.p;
                _sweep.C = _xf.p;
                _sweep.A0 = rotation;
                _sweep.A = rotation;
            }

            world.AddBody(this); //FPE note: bodies can't live without a World
        }
コード例 #14
0
ファイル: Body.cs プロジェクト: boris2/mmogameproject2
        public Body(World world, Vector2? position = null, float rotation = 0, object userdata = null)
        {
            FixtureList = new List<Fixture>();
            BodyId = _bodyIdCounter++;
            World = world;

            UserData = userdata;
            GravityScale = 1.0f;
            AppendFlags(BodyFlags.AutoSleep);

            #if !USE_AWAKE_BODY_SET
            Awake = true;
            #endif
            BodyType = BodyType.Static;
            Enabled = true;

            Xf.q.Set(rotation);

            if (position.HasValue)
            {
                Xf.p = position.Value;
                Sweep.C0 = Xf.p;
                Sweep.C = Xf.p;
                Sweep.A0 = rotation;
                Sweep.A = rotation;
            }

            world.AddBody(this);
        }
コード例 #15
0
ファイル: Body.cs プロジェクト: Daramkun/Misty
        public Body(World world, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userdata = null)
        {
            FixtureList = new List<Fixture>();
            BodyId = _bodyIdCounter++;

            _world = world;
            _enabled = true;
            _awake = true;
            _sleepingAllowed = true;

            UserData = userdata;
            GravityScale = 1.0f;
            BodyType = bodyType;

            _xf.q.Set(rotation);

            //FPE: optimization
            if (position != Vector2.Zero)
            {
                _xf.p = position;
                _sweep.C0 = _xf.p;
                _sweep.C = _xf.p;
            }

            //FPE: optimization
            if (rotation != 0)
            {
                _sweep.A0 = rotation;
                _sweep.A = rotation;
            }

            world.AddBody(this); //FPE note: bodies can't live without a World
        }
コード例 #16
0
ファイル: Body.cs プロジェクト: frotein/TinyUniverse
        public Body(World world, object userData)
        {
            FixtureList = new List<Fixture>(32);
            BodyId = _bodyIdCounter++;

            World = world;
            UserData = userData;

            GravityScale = 1.0f;
            FixedRotation = false;
            IsBullet = false;
            SleepingAllowed = true;
#if !USE_AWAKE_BODY_SET
            Awake = true;
#endif
            BodyType = BodyType.Static;
            Enabled = true;

            Xf.q.Set(0);

            world.AddBody(this);
        }