/** * Set the contact filtering data. This is an expensive operation and should not be called * frequently. This will not update contacts until the next time step when either parent body is * awake. This automatically calls refilter. * * @param filter */ public void setFilterData(final Filter filter) { m_filter.set(filter); refilter(); }
/** Set the contact filtering data. This will not update contacts until the next time step when either parent body is active and * awake. This automatically calls Refilter. */ public void setFilterData (Filter filter) { org.jbox2d.dynamics.Filter f = new org.jbox2d.dynamics.Filter(); f.categoryBits = filter.categoryBits; f.groupIndex = filter.groupIndex; f.maskBits = filter.maskBits; fixture.setFilterData(f); }
public org.jbox2d.dynamics.FixtureDef toJBox2d () { org.jbox2d.dynamics.FixtureDef fd = new org.jbox2d.dynamics.FixtureDef(); fd.density = density; fd.filter = new org.jbox2d.dynamics.Filter(); fd.filter.categoryBits = filter.categoryBits; fd.filter.groupIndex = filter.groupIndex; fd.filter.maskBits = filter.maskBits; fd.friction = friction; fd.isSensor = isSensor; fd.restitution = restitution; fd.shape = shape.shape; return fd; } }
/** Get the body transform for the body's origin. */ public Transform getTransform () { org.jbox2d.common.Transform trans = body.getTransform(); transform.vals[Transform.POS_X] = trans.p.x; transform.vals[Transform.POS_Y] = trans.p.y; transform.vals[Transform.COS] = trans.q.c; transform.vals[Transform.SIN] = trans.q.s; return transform; }
/** Get the sleeping state of this body. * @return true if the body is sleeping. */ public boolean isAwake () { return body.isAwake(); }
/** Get the total mass of the body. * @return the mass, usually in kilograms (kg). */ public float getMass () { return body.getMass(); }
/** Get the rotational inertia of the body about the local origin. * @return the rotational inertia, usually in kg-m^2. */ public float getInertia () { return body.getInertia(); }
/** * Initialize the bodies, anchors, axis, and reference angle using the world anchor and world * axis. */ public void initialize(Body bA, Body bB, Vec2 anchor) { bodyA = bA; bodyB = bB; bA.getLocalPointToOut(anchor, localAnchorA); bB.getLocalPointToOut(anchor, localAnchorB); } }
/** * Destroy a particle. The particle is removed after the next step. * * @param index */ public void destroyParticle(int index) { destroyParticle(index, false); }
/** This resets the mass properties to the sum of the mass properties of the fixtures. This normally does not need to be called * unless you called SetMassData to override the mass and you later want to reset the mass. */ public void resetMassData () { body.resetMassData(); }
/** Is this fixture a sensor (non-solid)? * @return the true if the shape is a sensor. */ public boolean isSensor () { return fixture.isSensor(); }
public FixtureDef() { shape = null; userData = null; friction = 0.2f; restitution = 0f; density = 0f; filter = new Filter(); isSensor = false; }
/** Set the type of this body. This may alter the mass and velocity. */ public void setType (BodyType type) { org.jbox2d.dynamics.BodyType t = org.jbox2d.dynamics.BodyType.DYNAMIC; if (type == BodyType.DynamicBody) t = org.jbox2d.dynamics.BodyType.DYNAMIC; if (type == BodyType.KinematicBody) t = org.jbox2d.dynamics.BodyType.KINEMATIC; if (type == BodyType.StaticBody) t = org.jbox2d.dynamics.BodyType.STATIC; body.setType(t); }
public Fixture() { m_userData = null; m_body = null; m_next = null; m_proxies = null; m_proxyCount = 0; m_shape = null; m_filter = new Filter(); }
public void setAllowSleep(boolean flag) { if (flag == m_allowSleep) { return; } m_allowSleep = flag; if (m_allowSleep == false) { for (Body b = m_bodyList; b != null; b = b.m_next) { b.setAwake(true); } } }
/** Set the sleep state of the body. A sleeping body has very low CPU cost. * @param flag set to true to put body to sleep, false to wake it. */ public void setAwake (boolean flag) { body.setAwake(flag); }