public static void AttachBoxFixture(this b2Body body, MetreVector @from, MetreVector to, Density density)
        {
            var boxShape = ObjectPool.Get <b2EdgeShape>();

            boxShape.Set(@from, to);
            body.CreateFixture(boxShape, density);
            ObjectPool.Return(boxShape);
        }
Esempio n. 2
0
 public DynamicBoxBody(
     EntityIdentifier identifier,
     MetreVector position,
     MetreSize size,
     Density density)
 {
     Identifier = identifier;
     body       = PhysicsWorld.SharedPhysicsWorld.CreateDynamicBody(Identifier, position);
     body.AttachBoxFixture(size, density);
 }
Esempio n. 3
0
 public static b2Body CreateDynamicBody(this b2World world, IEntityIdentifier identifier, MetreVector position)
 {
     return(world.CreateBody(new b2BodyDef
     {
         type = b2BodyType.b2_dynamicBody,
         position = position,
         userData = identifier
     }));
 }