@Override public void initTest(boolean deserialized) { { BodyDef bd = new BodyDef(); Body ground = m_world.createBody(bd); ChainShape shape = new ChainShape(); Vec2[] vertices = new Vec2[] {new Vec2(-20, 0), new Vec2(20, 0), new Vec2(20, 40), new Vec2(-20, 40)}; shape.createLoop(vertices, 4); ground.createFixture(shape, 0.0f); } m_world.setParticleRadius(0.15f); m_world.setParticleDamping(0.2f); { PolygonShape shape = new PolygonShape(); shape.setAsBox(8, 10, new Vec2(-12, 10.1f), 0); ParticleGroupDef pd = new ParticleGroupDef(); pd.shape = shape; m_world.createParticleGroup(pd); } }
transform.setIdentity(); int firstIndex = m_count; if (groupDef.getShape() != null) { final ParticleDef particleDef = tempParticleDef; particleDef.setTypeFlags(groupDef.getTypeFlags()); particleDef.color = groupDef.getColor(); particleDef.setUserData(groupDef.getUserData()); Shape shape = groupDef.getShape(); transform.set(groupDef.getPosition(), groupDef.getAngle()); AABB aabb = temp; int childCount = shape.getChildCount(); particleDef.position.x = p.x; particleDef.position.y = p.y; p.subLocal(groupDef.getPosition()); Vec2.crossToOutUnsafe(groupDef.getAngularVelocity(), p, particleDef.velocity); particleDef.velocity.addLocal(groupDef.getLinearVelocity()); createParticle(particleDef); group.m_firstIndex = firstIndex; group.m_lastIndex = lastIndex; group.m_groupFlags = groupDef.getGroupFlags(); group.m_strength = groupDef.getStrength(); group.m_userData = groupDef.getUserData(); group.m_transform.set(transform); group.m_destroyAutomatically = groupDef.isDestroyAutomatically(); group.m_prev = null; group.m_next = m_groupList;
system.m_flagsBuffer.data[a] | system.m_flagsBuffer.data[b] | system.m_flagsBuffer.data[c]; triad.strength = def.getStrength(); final float midPointx = (float) 1 / 3 * (pa.x + pb.x + pc.x); final float midPointy = (float) 1 / 3 * (pa.y + pb.y + pc.y);
ParticleGroupDef pd = new ParticleGroupDef(); pd.flags = 0;
shape.m_p.set(0, 30); shape.m_radius = 20; ParticleGroupDef pd = new ParticleGroupDef(); pd.flags = ParticleType.b2_waterParticle; pd.shape = shape;
ParticleGroupDef pd = new ParticleGroupDef(); pd.flags = pd.flags; pd.shape = shape;
ParticleGroupDef pd = new ParticleGroupDef(); pd.flags = ParticleType.b2_tensileParticle | ParticleType.b2_viscousParticle; pd.shape = shape;