Exemple #1
0
 private void Activate()
 {
     if (!holdBody.IsValid())
     {
         holdBody          = PhysicsWorld.AddBody();
         holdBody.BodyType = PhysicsBodyType.Keyframed;
     }
 }
Exemple #2
0
        public Body(PhysicsWorld world, Vector2?position = null, float rotation = 0, object userdata = null)
        {
            FixtureList = new List <Fixture>();
            BodyId      = _bodyIdCounter++;
            _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
        }