@Override protected Fixture newObject () { return new Fixture(null, 0); } };
/** Creates a fixture from a shape and attach it to this body. This is a convenience function. Use b2FixtureDef if you need to * set parameters like friction, restitution, user data, or filtering. If the density is non-zero, this function automatically * updates the mass of the body. * @param shape the shape to be cloned. * @param density the shape density (set to zero for static bodies). * @warning This function is locked during callbacks. */ public Fixture createFixture (Shape shape, float density) { org.jbox2d.dynamics.Fixture f = body.createFixture(shape.shape, density); Fixture fixture = new Fixture(this, f); fixtures.add(fixture); world.fixtures.put(f, fixture); return fixture; }
/** Creates a fixture and attach it to this body. Use this function if you need to set some fixture parameters, like friction. * Otherwise you can create the fixture directly from a shape. If the density is non-zero, this function automatically updates * the mass of the body. Contacts are not created until the next time step. * @param def the fixture definition. * @warning This function is locked during callbacks. */ public Fixture createFixture (FixtureDef def) { org.jbox2d.dynamics.FixtureDef fd = def.toJBox2d(); org.jbox2d.dynamics.Fixture f = body.createFixture(fd); Fixture fixture = new Fixture(this, f); fixtures.add(fixture); world.fixtures.put(f, fixture); return fixture; }
@Override protected Fixture newObject () { return new Fixture(null, 0); } };