/** * Get the type of the child shape. You can use this to down cast to the concrete shape. * * @return the shape type. */ public ShapeType getType() { return m_shape.getType(); }
/** * Test a point for containment in this fixture. This only works for convex shapes. * * @param p a point in world coordinates. * @return */ public boolean testPoint(final Vec2 p) { return m_shape.testPoint(m_body.m_xf, p); }
m_shape = def.shape.clone(); int childCount = m_shape.getChildCount(); if (m_proxies == null) { m_proxies = new FixtureProxy[childCount];
public void createProxies(BroadPhase broadPhase, final Transform xf) { assert (m_proxyCount == 0); // Create proxies in the broad-phase. m_proxyCount = m_shape.getChildCount(); for (int i = 0; i < m_proxyCount; ++i) { FixtureProxy proxy = m_proxies[i]; m_shape.computeAABB(proxy.aabb, xf, i); proxy.proxyId = broadPhase.createProxy(proxy.aabb, proxy); proxy.fixture = this; proxy.childIndex = i; } }
transform.set(groupDef.position, groupDef.angle); AABB aabb = temp; int childCount = shape.getChildCount(); for (int childIndex = 0; childIndex < childCount; childIndex++) { if (childIndex == 0) { shape.computeAABB(aabb, identity, childIndex); } else { AABB childAABB = temp2; shape.computeAABB(childAABB, identity, childIndex); aabb.combine(childAABB); p.x = x; p.y = y; if (shape.testPoint(identity, p)) { Transform.mulToOut(transform, p, p); particleDef.position.x = p.x;
m_shape.computeAABB(aabb1, transform1, proxy.childIndex); m_shape.computeAABB(aab, transform2, proxy.childIndex);
int childCount = shape.getChildCount(); for (int childIndex = 0; childIndex < childCount; childIndex++) { AABB aabb = fixture.getAABB(childIndex);
/** * Cast a ray against this shape. * * @param output the ray-cast results. * @param input the ray-cast input parameters. * @param output * @param input */ public boolean raycast(RayCastOutput output, RayCastInput input, int childIndex) { return m_shape.raycast(output, input, m_body.m_xf, childIndex); }
/** * Get the mass data for this fixture. The mass data is based on the density and the shape. The * rotational inertia is about the shape's origin. * * @return */ public void getMassData(MassData massData) { m_shape.computeMass(massData, m_density); }
/** * Compute the distance from this fixture. * * @param p a point in world coordinates. * @return distance */ public float computeDistance(Vec2 p, int childIndex, Vec2 normalOut) { return m_shape.computeDistanceToOut(m_body.getTransform(), p, childIndex, normalOut); }
transform.set(groupDef.position, groupDef.angle); AABB aabb = temp; int childCount = shape.getChildCount(); for (int childIndex = 0; childIndex < childCount; childIndex++) { if (childIndex == 0) { shape.computeAABB(aabb, identity, childIndex); } else { AABB childAABB = temp2; shape.computeAABB(childAABB, identity, childIndex); aabb.combine(childAABB); p.x = x; p.y = y; if (shape.testPoint(identity, p)) { Transform.mulToOut(transform, p, p); particleDef.position.x = p.x;
public void createProxies(BroadPhase broadPhase, final Transform xf) { assert (m_proxyCount == 0); // Create proxies in the broad-phase. m_proxyCount = m_shape.getChildCount(); for (int i = 0; i < m_proxyCount; ++i) { FixtureProxy proxy = m_proxies[i]; m_shape.computeAABB(proxy.aabb, xf, i); proxy.proxyId = broadPhase.createProxy(proxy.aabb, proxy); proxy.fixture = this; proxy.childIndex = i; } }
public int destroyParticlesInShape(Shape shape, Transform xf, boolean callDestructionListener) { dpcallback.init(this, shape, xf, callDestructionListener); shape.computeAABB(temp, xf, 0); m_world.queryAABB(dpcallback, temp); return dpcallback.destroyed; }
float invBm = bm > 0 ? 1 / bm : 0; float invBI = bI > 0 ? 1 / bI : 0; int childCount = shape.getChildCount(); for (int childIndex = 0; childIndex < childCount; childIndex++) { AABB aabb = fixture.getAABB(childIndex);
/** * Cast a ray against this shape. * * @param output the ray-cast results. * @param input the ray-cast input parameters. * @param output * @param input */ public boolean raycast(RayCastOutput output, RayCastInput input, int childIndex) { return m_shape.raycast(output, input, m_body.m_xf, childIndex); }
/** * Get the mass data for this fixture. The mass data is based on the density and the shape. The * rotational inertia is about the shape's origin. * * @return */ public void getMassData(MassData massData) { m_shape.computeMass(massData, m_density); }
/** * Compute the distance from this fixture. * * @param p a point in world coordinates. * @return distance */ public float computeDistance(Vec2 p, int childIndex, Vec2 normalOut) { return m_shape.computeDistanceToOut(m_body.getTransform(), p, childIndex, normalOut); }
transform.set(groupDef.position, groupDef.angle); AABB aabb = temp; int childCount = shape.getChildCount(); for (int childIndex = 0; childIndex < childCount; childIndex++) { if (childIndex == 0) { shape.computeAABB(aabb, identity, childIndex); } else { AABB childAABB = temp2; shape.computeAABB(childAABB, identity, childIndex); aabb.combine(childAABB); p.x = x; p.y = y; if (shape.testPoint(identity, p)) { Transform.mulToOut(transform, p, p); particleDef.position.x = p.x;
/** Returns the shape of this fixture */ public Shape getShape () { if (shape == null) { org.jbox2d.collision.shapes.Shape shape2 = fixture.getShape(); ShapeType type = shape2.getType(); if (type == ShapeType.CHAIN) shape = new ChainShape((org.jbox2d.collision.shapes.ChainShape)shape2); if (type == ShapeType.CIRCLE) shape = new CircleShape((org.jbox2d.collision.shapes.CircleShape)shape2); if (type == ShapeType.EDGE) shape = new EdgeShape((org.jbox2d.collision.shapes.EdgeShape)shape2); if (type == ShapeType.POLYGON) shape = new PolygonShape((org.jbox2d.collision.shapes.PolygonShape)shape2); } return shape; }
public void createProxies(BroadPhase broadPhase, final Transform xf) { assert (proxyCount == 0); // Create proxies in the broad-phase. proxyCount = shape.getChildCount(); for (int i = 0; i < proxyCount; ++i) { FixtureProxy proxy = m_proxies[i]; shape.computeAABB(proxy.aabb, xf, i); proxy.proxyId = broadPhase.createProxy(proxy.aabb, proxy); proxy.fixture = this; proxy.childIndex = i; } }