/** Is the world locked (in the middle of a time step). */ public boolean isLocked () { return world.isLocked(); }
/** * Create a particle group whose properties have been defined. No reference to the definition is * retained. * * @warning This function is locked during callbacks. */ public ParticleGroup createParticleGroup(ParticleGroupDef def) { assert (isLocked() == false); if (isLocked()) { return null; } ParticleGroup g = m_particleSystem.createParticleGroup(def); return g; }
/** * Join two particle groups. * * @param the first group. Expands to encompass the second group. * @param the second group. It is destroyed. * @warning This function is locked during callbacks. */ public void joinParticleGroups(ParticleGroup groupA, ParticleGroup groupB) { assert (isLocked() == false); if (isLocked()) { return; } m_particleSystem.joinParticleGroups(groupA, groupB); }
/** * Destroy particles in a group. This function is locked during callbacks. * * @param The particle group to destroy. * @param Whether to call the world b2DestructionListener for each particle is destroyed. * @warning This function is locked during callbacks. */ public void destroyParticlesInGroup(ParticleGroup group, boolean callDestructionListener) { assert (isLocked() == false); if (isLocked()) { return; } m_particleSystem.destroyParticlesInGroup(group, callDestructionListener); }
/** * Create a particle whose properties have been defined. No reference to the definition is * retained. A simulation step must occur before it's possible to interact with a newly created * particle. For example, DestroyParticleInShape() will not destroy a particle until Step() has * been called. * * @warning This function is locked during callbacks. * @return the index of the particle. */ public int createParticle(ParticleDef def) { assert (isLocked() == false); if (isLocked()) { return 0; } int p = m_particleSystem.createParticle(def); return p; }
/** * Destroy particles inside a shape. This function is locked during callbacks. In addition, this * function immediately destroys particles in the shape in contrast to DestroyParticle() which * defers the destruction until the next simulation step. * * @param Shape which encloses particles that should be destroyed. * @param Transform applied to the shape. * @param Whether to call the world b2DestructionListener for each particle destroyed. * @warning This function is locked during callbacks. * @return Number of particles destroyed. */ public int destroyParticlesInShape(Shape shape, Transform xf, boolean callDestructionListener) { assert (isLocked() == false); if (isLocked()) { return 0; } return m_particleSystem.destroyParticlesInShape(shape, xf, callDestructionListener); }
/** * create a rigid body given a definition. No reference to the definition is retained. * * @warning This function is locked during callbacks. * @param def * @return */ public Body createBody(BodyDef def) { assert (isLocked() == false); if (isLocked()) { return null; } // TODO djm pooling Body b = new Body(def, this); // add to world doubly linked list b.m_prev = null; b.m_next = m_bodyList; if (m_bodyList != null) { m_bodyList.m_prev = b; } m_bodyList = b; ++m_bodyCount; return b; }
/** * Set the position of the body's origin and rotation. This breaks any contacts and wakes the * other bodies. Manipulating a body's transform may cause non-physical behavior. Note: contacts * are updated on the next call to World.step(). * * @param position the world position of the body's local origin. * @param angle the world rotation in radians. */ public final void setTransform(Vec2 position, float angle) { assert (m_world.isLocked() == false); if (m_world.isLocked() == true) { return; } m_xf.q.set(angle); m_xf.p.set(position); // m_sweep.c0 = m_sweep.c = Mul(m_xf, m_sweep.localCenter); Transform.mulToOutUnsafe(m_xf, m_sweep.localCenter, m_sweep.c); m_sweep.a = angle; m_sweep.c0.set(m_sweep.c); m_sweep.a0 = m_sweep.a; BroadPhase broadPhase = m_world.m_contactManager.m_broadPhase; for (Fixture f = m_fixtureList; f != null; f = f.m_next) { f.synchronize(broadPhase, m_xf, m_xf); } }
assert (m_world.isLocked() == false);
/** * Create a particle group whose properties have been defined. No reference to the definition is * retained. * * @warning This function is locked during callbacks. */ public ParticleGroup createParticleGroup(ParticleGroupDef def) { assert (isLocked() == false); if (isLocked()) { return null; } ParticleGroup g = m_particleSystem.createParticleGroup(def); return g; }
/** * Join two particle groups. * * @param the first group. Expands to encompass the second group. * @param the second group. It is destroyed. * @warning This function is locked during callbacks. */ public void joinParticleGroups(ParticleGroup groupA, ParticleGroup groupB) { assert (isLocked() == false); if (isLocked()) { return; } m_particleSystem.joinParticleGroups(groupA, groupB); }
/** * Destroy particles in a group. This function is locked during callbacks. * * @param The particle group to destroy. * @param Whether to call the world b2DestructionListener for each particle is destroyed. * @warning This function is locked during callbacks. */ public void destroyParticlesInGroup(ParticleGroup group, boolean callDestructionListener) { assert (isLocked() == false); if (isLocked()) { return; } m_particleSystem.destroyParticlesInGroup(group, callDestructionListener); }
/** * Create a particle whose properties have been defined. No reference to the definition is * retained. A simulation step must occur before it's possible to interact with a newly created * particle. For example, DestroyParticleInShape() will not destroy a particle until Step() has * been called. * * @warning This function is locked during callbacks. * @return the index of the particle. */ public int createParticle(ParticleDef def) { assert (isLocked() == false); if (isLocked()) { return 0; } int p = m_particleSystem.createParticle(def); return p; }