Module org.dyn4j

Class World

  • All Implemented Interfaces:
    DataContainer, Shiftable

    @Deprecated
    public class World
    extends Object
    implements Shiftable, DataContainer
    Deprecated.
    Deprecated in 4.0.0. Use the World class in the world package instead.
    Manages the logic of collision detection, resolution, and reporting.

    Interfacing with dyn4j starts with this class. Create a new instance of this class and add bodies and joints. Then call one of the update or step methods in your game loop to move the physics engine forward in time.

    Via the addListener(Listener) method, a World instance can have multiple listeners for all the listener types. Some listener types return a boolean to indicate continuing or allowing something, like CollisionListener. If, for example, there are multiple CollisionListeners and any one of them returns false for an event, the collision is skipped. However, all listeners will still be called no matter if the first returned false.

    Since:
    1.0.0
    Version:
    4.0.0
    Author:
    William Bittle
    • Field Detail

      • EARTH_GRAVITY

        public static final Vector2 EARTH_GRAVITY
        Deprecated.
        Earths gravity constant
      • ZERO_GRAVITY

        public static final Vector2 ZERO_GRAVITY
        Deprecated.
        Zero gravity constant
    • Constructor Detail

      • World

        public World​(Capacity initialCapacity)
        Deprecated.
        Optional constructor.

        Defaults to using EARTH_GRAVITY, DynamicAABBTree broad-phase, Gjk narrow-phase, and ClippingManifoldSolver.

        The initial capacity specifies the estimated number of bodies that the simulation will have at any one time. This is used to size internal structures to improve performance. The internal structures can grow past the initial capacity.

        Parameters:
        initialCapacity - the initial capacity settings
        Since:
        3.1.1
      • World

        public World​(Capacity initialCapacity,
                     Bounds bounds)
        Deprecated.
        Full constructor.

        Defaults to using EARTH_GRAVITY, DynamicAABBTree broad-phase, Gjk narrow-phase, and ClippingManifoldSolver.

        The initial capacity specifies the estimated number of bodies that the simulation will have at any one time. This is used to size internal structures to improve performance. The internal structures can grow past the initial capacity.

        Parameters:
        initialCapacity - the initial capacity settings
        bounds - the bounds of the World; can be null
        Throws:
        NullPointerException - if initialCapacity is null
        Since:
        3.1.1
    • Method Detail

      • update

        public boolean update​(double elapsedTime)
        Deprecated.
        Updates the World.

        This method will only update the world given the step frequency contained in the Settings object. You can use the StepListener interface to listen for when a step is actually performed. In addition, this method will return true if a step was performed.

        This method performs, at maximum, one simulation step. Any remaining time from the previous call of this method is added to the given elapsed time to determine if a step needs to be performed. If the given elapsed time is usually greater than the step frequency, consider using the update(double, int) method instead.

        Alternatively you can call the updatev(double) method to use a variable time step.

        Parameters:
        elapsedTime - the elapsed time in seconds
        Returns:
        boolean true if the World performed a simulation step
        See Also:
        update(double, int), updatev(double), getAccumulatedTime()
      • update

        public boolean update​(double elapsedTime,
                              int maximumSteps)
        Deprecated.
        Updates the World.

        This method will only update the world given the step frequency contained in the Settings object. You can use the StepListener interface to listen for when a step is actually performed.

        Unlike the update(double) method, this method will perform more than one step based on the given elapsed time. For example, if the given elapsed time + the remaining time from the last call of this method is 2 * step frequency, then 2 steps will be performed. Use the maximumSteps parameter to put an upper bound on the number of steps performed.

        Alternatively you can call the updatev(double) method to use a variable time step.

        Parameters:
        elapsedTime - the elapsed time in seconds
        maximumSteps - the maximum number of steps to perform
        Returns:
        boolean true if the World performed at least one simulation step
        Since:
        3.1.10
        See Also:
        update(double), updatev(double), getAccumulatedTime()
      • update

        public boolean update​(double elapsedTime,
                              double stepElapsedTime)
        Deprecated.
        Updates the World.

        This method will only update the world given the step frequency contained in the Settings object. You can use the StepListener interface to listen for when a step is actually performed. In addition, this method will return true if a step was performed.

        This method performs, at maximum, one simulation step. Any remaining time from the previous call of this method is added to the given elapsed time to determine if a step needs to be performed. If the given elapsed time is usually greater than the step frequency, consider using the update(double, int) method instead.

        The stepElapsedTime parameter provides a way for the World to continue to update at the frequency defined in the Settings object, but advance the simulation by the given time.

        Alternatively you can call the updatev(double) method to use a variable time step.

        Parameters:
        elapsedTime - the elapsed time in seconds
        stepElapsedTime - the time, in seconds, that the simulation should be advanced
        Returns:
        boolean true if the World performed at least one simulation step
        Since:
        3.2.4
        See Also:
        update(double), updatev(double), getAccumulatedTime()
      • update

        public boolean update​(double elapsedTime,
                              double stepElapsedTime,
                              int maximumSteps)
        Deprecated.
        Updates the World.

        This method will only update the world given the step frequency contained in the Settings object. You can use the StepListener interface to listen for when a step is actually performed.

        Unlike the update(double) method, this method will perform more than one step based on the given elapsed time. For example, if the given elapsed time + the remaining time from the last call of this method is 2 * step frequency, then 2 steps will be performed. Use the maximumSteps parameter to put an upper bound on the number of steps performed.

        The stepElapsedTime parameter provides a way for the World to continue to update at the frequency defined in the Settings object, but advance the simulation by the given time.

        Alternatively you can call the updatev(double) method to use a variable time step.

        Parameters:
        elapsedTime - the elapsed time in seconds
        stepElapsedTime - the time, in seconds, that the simulation should be advanced for each step; if less than or equal to zero Settings.getStepFrequency() will be used
        maximumSteps - the maximum number of steps to perform
        Returns:
        boolean true if the World performed at least one simulation step
        Since:
        3.2.4
        See Also:
        update(double), updatev(double), getAccumulatedTime()
      • updatev

        public void updatev​(double elapsedTime)
        Deprecated.
        Updates the World.

        This method will update the world on every call. Unlike the update(double) method, this method uses the given elapsed time and does not attempt to update the world on a set interval.

        This method immediately returns if the given elapsedTime is less than or equal to zero.

        Parameters:
        elapsedTime - the elapsed time in seconds
        See Also:
        update(double), update(double, int)
      • step

        public void step​(int steps)
        Deprecated.
        Performs the given number of simulation steps using the step frequency in Settings.

        This method immediately returns if the given step count is less than or equal to zero.

        Parameters:
        steps - the number of simulation steps to perform
      • step

        public void step​(int steps,
                         double elapsedTime)
        Deprecated.
        Performs the given number of simulation steps using the given elapsed time for each step.

        This method immediately returns if the given elapsedTime or step count is less than or equal to zero.

        Parameters:
        steps - the number of simulation steps to perform
        elapsedTime - the elapsed time for each step
      • raycast

        public boolean raycast​(Vector2 start,
                               Vector2 end,
                               boolean ignoreSensors,
                               boolean all,
                               List<RaycastResult> results)
        Deprecated.
        Performs a raycast against all the Bodys in the World.

        The given RaycastResult list, results, will be filled with the raycast results if the given ray intersected any bodies.

        The RaycastResult class implements the Comparable interface to allow sorting by distance from the ray's origin.

        If the all flag is false, the results list will only contain the closest result (if any).

        All raycasts pass through the RaycastListeners before being tested. If any RaycastListener doesn't allow the raycast then the body will not be tested.

        Bodies that contain the start of the ray will not be included in the results.

        Inactive bodies are ignored in this test.

        Parameters:
        start - the start point
        end - the end point
        ignoreSensors - true if sensor BodyFixtures should be ignored
        all - true if all intersected Bodys should be returned; false if only the closest Body should be returned
        results - a list to contain the results of the raycast
        Returns:
        boolean true if at least one Body was intersected by the Ray
        Throws:
        NullPointerException - if start, end, or results is null
        Since:
        2.0.0
        See Also:
        raycast(Ray, double, boolean, boolean, List), RaycastListener.allow(Ray, Body, BodyFixture)
      • raycast

        public boolean raycast​(Vector2 start,
                               Vector2 end,
                               boolean ignoreSensors,
                               boolean ignoreInactive,
                               boolean all,
                               List<RaycastResult> results)
        Deprecated.
        Performs a raycast against all the Bodys in the World.

        The given RaycastResult list, results, will be filled with the raycast results if the given ray intersected any bodies.

        The RaycastResult class implements the Comparable interface to allow sorting by distance from the ray's origin.

        If the all flag is false, the results list will only contain the closest result (if any).

        All raycasts pass through the RaycastListeners before being tested. If any RaycastListener doesn't allow the raycast then the body will not be tested.

        Bodies that contain the start of the ray will not be included in the results.

        Parameters:
        start - the start point
        end - the end point
        ignoreSensors - true if sensor BodyFixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        all - true if all intersected Bodys should be returned; false if only the closest Body should be returned
        results - a list to contain the results of the raycast
        Returns:
        boolean true if at least one Body was intersected by the Ray
        Throws:
        NullPointerException - if start, end, or results is null
        Since:
        3.1.9
        See Also:
        raycast(Ray, double, boolean, boolean, boolean, List), RaycastListener.allow(Ray, Body, BodyFixture)
      • raycast

        public boolean raycast​(Vector2 start,
                               Vector2 end,
                               Filter filter,
                               boolean ignoreSensors,
                               boolean ignoreInactive,
                               boolean all,
                               List<RaycastResult> results)
        Deprecated.
        Performs a raycast against all the Bodys in the World.

        The given RaycastResult list, results, will be filled with the raycast results if the given ray intersected any bodies.

        The RaycastResult class implements the Comparable interface to allow sorting by distance from the ray's origin.

        If the all flag is false, the results list will only contain the closest result (if any).

        All raycasts pass through the RaycastListeners before being tested. If any RaycastListener doesn't allow the raycast then the body will not be tested.

        Bodies that contain the start of the ray will not be included in the results.

        Parameters:
        start - the start point
        end - the end point
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor BodyFixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        all - true if all intersected Bodys should be returned; false if only the closest Body should be returned
        results - a list to contain the results of the raycast
        Returns:
        boolean true if at least one Body was intersected by the Ray
        Throws:
        NullPointerException - if start, end, or results is null
        Since:
        3.1.9
        See Also:
        raycast(Ray, double, Filter, boolean, boolean, boolean, List), RaycastListener.allow(Ray, Body, BodyFixture)
      • raycast

        public boolean raycast​(Ray ray,
                               double maxLength,
                               boolean ignoreSensors,
                               boolean all,
                               List<RaycastResult> results)
        Deprecated.
        Performs a raycast against all the Bodys in the World.

        The given RaycastResult list, results, will be filled with the raycast results if the given ray intersected any bodies.

        The RaycastResult class implements the Comparable interface to allow sorting by distance from the ray's origin.

        If the all flag is false, the results list will only contain the closest result (if any).

        Pass 0 into the maxLength field to specify an infinite length Ray.

        All raycasts pass through the RaycastListeners before being tested. If any RaycastListener doesn't allow the raycast then the body will not be tested.

        Bodies that contain the start of the ray will not be included in the results.

        Inactive bodies are ignored in this test.

        Parameters:
        ray - the Ray
        maxLength - the maximum length of the ray; 0 for infinite length
        ignoreSensors - true if sensor BodyFixtures should be ignored
        all - true if all intersected Bodys should be returned; false if only the closest Body should be returned
        results - a list to contain the results of the raycast
        Returns:
        boolean true if at least one Body was intersected by the given Ray
        Throws:
        NullPointerException - if ray or results is null
        Since:
        2.0.0
        See Also:
        raycast(Vector2, Vector2, boolean, boolean, List), RaycastListener.allow(Ray, Body, BodyFixture)
      • raycast

        public boolean raycast​(Ray ray,
                               double maxLength,
                               boolean ignoreSensors,
                               boolean ignoreInactive,
                               boolean all,
                               List<RaycastResult> results)
        Deprecated.
        Performs a raycast against all the Bodys in the World.

        The given RaycastResult list, results, will be filled with the raycast results if the given ray intersected any bodies.

        The RaycastResult class implements the Comparable interface to allow sorting by distance from the ray's origin.

        If the all flag is false, the results list will only contain the closest result (if any).

        Pass 0 into the maxLength field to specify an infinite length Ray.

        All raycasts pass through the RaycastListeners before being tested. If any RaycastListener doesn't allow the raycast then the body will not be tested.

        Bodies that contain the start of the ray will not be included in the results.

        Parameters:
        ray - the Ray
        maxLength - the maximum length of the ray; 0 for infinite length
        ignoreSensors - true if sensor BodyFixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        all - true if all intersected Bodys should be returned; false if only the closest Body should be returned
        results - a list to contain the results of the raycast
        Returns:
        boolean true if at least one Body was intersected by the given Ray
        Throws:
        NullPointerException - if ray or results is null
        Since:
        3.1.9
        See Also:
        raycast(Vector2, Vector2, boolean, boolean, boolean, List), RaycastListener.allow(Ray, Body, BodyFixture)
      • raycast

        public boolean raycast​(Ray ray,
                               double maxLength,
                               Filter filter,
                               boolean ignoreSensors,
                               boolean ignoreInactive,
                               boolean all,
                               List<RaycastResult> results)
        Deprecated.
        Performs a raycast against all the Bodys in the World.

        The given RaycastResult list, results, will be filled with the raycast results if the given ray intersected any bodies.

        The RaycastResult class implements the Comparable interface to allow sorting by distance from the ray's origin.

        If the all flag is false, the results list will only contain the closest result (if any).

        Pass 0 into the maxLength field to specify an infinite length Ray.

        All raycasts pass through the RaycastListeners before being tested. If any RaycastListener doesn't allow the raycast then the body will not be tested.

        Bodies that contain the start of the ray will not be included in the results.

        Parameters:
        ray - the Ray
        maxLength - the maximum length of the ray; 0 for infinite length
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor BodyFixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        all - true if all intersected Bodys should be returned; false if only the closest Body should be returned
        results - a list to contain the results of the raycast
        Returns:
        boolean true if at least one Body was intersected by the given Ray
        Throws:
        NullPointerException - if ray or results is null
        Since:
        3.1.9
        See Also:
        raycast(Vector2, Vector2, Filter, boolean, boolean, boolean, List), RaycastListener.allow(Ray, Body, BodyFixture)
      • raycast

        public boolean raycast​(Ray ray,
                               Body body,
                               double maxLength,
                               boolean ignoreSensors,
                               RaycastResult result)
        Deprecated.
        Performs a raycast against the given Body and returns true if the ray intersects the body.

        The given RaycastResult object, result, will be filled with the raycast result if the given ray intersected the given body.

        Pass 0 into the maxLength field to specify an infinite length Ray.

        All raycasts pass through the RaycastListeners before being tested. If any RaycastListener doesn't allow the raycast then the body will not be tested.

        Returns false if the start position of the ray lies inside the given body.

        Parameters:
        ray - the Ray to cast
        body - the Body to test
        maxLength - the maximum length of the ray; 0 for infinite length
        ignoreSensors - whether or not to ignore sensor BodyFixtures
        result - the raycast result
        Returns:
        boolean true if the Ray intersects the Body
        Throws:
        NullPointerException - if ray, body, or result is null
        Since:
        2.0.0
        See Also:
        raycast(Vector2, Vector2, Body, boolean, RaycastResult), RaycastListener.allow(Ray, Body, BodyFixture)
      • raycast

        public boolean raycast​(Ray ray,
                               Body body,
                               double maxLength,
                               Filter filter,
                               boolean ignoreSensors,
                               RaycastResult result)
        Deprecated.
        Performs a raycast against the given Body and returns true if the ray intersects the body.

        The given RaycastResult object, result, will be filled with the raycast result if the given ray intersected the given body.

        Pass 0 into the maxLength field to specify an infinite length Ray.

        All raycasts pass through the RaycastListeners before being tested. If any RaycastListener doesn't allow the raycast then the body will not be tested.

        Returns false if the start position of the ray lies inside the given body.

        Parameters:
        ray - the Ray to cast
        body - the Body to test
        maxLength - the maximum length of the ray; 0 for infinite length
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - whether or not to ignore sensor BodyFixtures
        result - the raycast result
        Returns:
        boolean true if the Ray intersects the Body
        Throws:
        NullPointerException - if ray, body, or result is null
        Since:
        3.1.9
        See Also:
        raycast(Vector2, Vector2, Body, Filter, boolean, RaycastResult), RaycastListener.allow(Ray, Body, BodyFixture)
      • convexCast

        public boolean convexCast​(Convex convex,
                                  Transform transform,
                                  Vector2 deltaPosition,
                                  boolean ignoreSensors,
                                  boolean all,
                                  List<ConvexCastResult> results)
        Deprecated.
        Performs a linear convex cast on the world, placing any detected collisions into the given results list.

        This method does a static test of bodies (in other words, does not take into account the bodies linear or angular velocity, but rather assumes they are stationary).

        The deltaPosition parameter is the linear cast vector determining the direction and magnitude of the cast.

        The ConvexCastResult class implements the Comparable interface to allow sorting by the time of impact.

        If the all flag is false, the results list will only contain the closest result (if any).

        All convex casts pass through the ConvexCastListeners before being tested. If any ConvexCastListener doesn't allow the convex cast, then the body will not be tested.

        For multi-fixtured bodies, only the fixture that has the minimum time of impact will be added to the results list.

        Bodies in collision with the given convex at the beginning of the cast are not included in the results.

        Inactive bodies are ignored in this test.

        Parameters:
        convex - the convex to cast
        transform - the initial position and orientation of the convex
        deltaPosition - Δposition; the change in position (the cast length and direction basically)
        ignoreSensors - true if sensor fixtures should be ignored in the tests
        all - true if all hits should be returned; false if only the first should be returned
        results - the list to add the results to
        Returns:
        boolean true if a collision was found
        Since:
        3.1.5
        See Also:
        convexCast(Convex, Transform, Vector2, double, boolean, boolean, boolean, List)
      • convexCast

        public boolean convexCast​(Convex convex,
                                  Transform transform,
                                  Vector2 deltaPosition,
                                  boolean ignoreSensors,
                                  boolean ignoreInactive,
                                  boolean all,
                                  List<ConvexCastResult> results)
        Deprecated.
        Performs a linear convex cast on the world, placing any detected collisions into the given results list.

        This method does a static test of bodies (in other words, does not take into account the bodies linear or angular velocity, but rather assumes they are stationary).

        The deltaPosition parameter is the linear cast vector determining the direction and magnitude of the cast.

        The ConvexCastResult class implements the Comparable interface to allow sorting by the time of impact.

        If the all flag is false, the results list will only contain the closest result (if any).

        All convex casts pass through the ConvexCastListeners before being tested. If any ConvexCastListener doesn't allow the convex cast, then the body will not be tested.

        For multi-fixtured bodies, only the fixture that has the minimum time of impact will be added to the results list.

        Bodies in collision with the given convex at the beginning of the cast are not included in the results.

        Parameters:
        convex - the convex to cast
        transform - the initial position and orientation of the convex
        deltaPosition - Δposition; the change in position (the cast length and direction basically)
        ignoreSensors - true if sensor fixtures should be ignored in the tests
        ignoreInactive - true if inactive bodies should be ignored in the tests
        all - true if all hits should be returned; false if only the first should be returned
        results - the list to add the results to
        Returns:
        boolean true if a collision was found
        Since:
        3.1.9
        See Also:
        convexCast(Convex, Transform, Vector2, double, boolean, boolean, boolean, List)
      • convexCast

        public boolean convexCast​(Convex convex,
                                  Transform transform,
                                  Vector2 deltaPosition,
                                  double deltaAngle,
                                  boolean ignoreSensors,
                                  boolean all,
                                  List<ConvexCastResult> results)
        Deprecated.
        Performs a linear convex cast on the world, placing any detected collisions into the given results list.

        This method does a static test of bodies (in other words, does not take into account the bodies linear or angular velocity, but rather assumes they are stationary).

        The deltaPosition parameter is the linear cast vector determining the direction and magnitude of the cast. The deltaAngle parameter is the change in angle over the linear cast and is interpolated linearly during detection.

        The ConvexCastResult class implements the Comparable interface to allow sorting by the time of impact.

        If the all flag is false, the results list will only contain the closest result (if any).

        All convex casts pass through the ConvexCastListeners before being tested. If any ConvexCastListener doesn't allow the convex cast, then the body will not be tested.

        For multi-fixtured bodies, only the fixture that has the minimum time of impact will be added to the results list.

        Bodies in collision with the given convex at the beginning of the cast are not included in the results.

        Inactive bodies are ignored in this test.

        Parameters:
        convex - the convex to cast
        transform - the initial position and orientation of the convex
        deltaPosition - Δposition; the change in position (the cast length and direction basically)
        deltaAngle - Δangle; the change in the angle; this is the change in the angle over the linear period
        ignoreSensors - true if sensor fixtures should be ignored in the tests
        all - true if all hits should be returned; false if only the first should be returned
        results - the list to add the results to
        Returns:
        boolean true if a collision was found
        Since:
        3.1.5
        See Also:
        convexCast(Convex, Transform, Vector2, double, boolean, boolean, boolean, List)
      • convexCast

        public boolean convexCast​(Convex convex,
                                  Transform transform,
                                  Vector2 deltaPosition,
                                  double deltaAngle,
                                  boolean ignoreSensors,
                                  boolean ignoreInactive,
                                  boolean all,
                                  List<ConvexCastResult> results)
        Deprecated.
        Performs a linear convex cast on the world, placing any detected collisions into the given results list.

        This method does a static test of bodies (in other words, does not take into account the bodies linear or angular velocity, but rather assumes they are stationary).

        The deltaPosition parameter is the linear cast vector determining the direction and magnitude of the cast. The deltaAngle parameter is the change in angle over the linear cast and is interpolated linearly during detection.

        The ConvexCastResult class implements the Comparable interface to allow sorting by the time of impact.

        If the all flag is false, the results list will only contain the closest result (if any).

        All convex casts pass through the ConvexCastListeners before being tested. If any ConvexCastListener doesn't allow the convex cast, then the body will not be tested.

        For multi-fixtured bodies, only the fixture that has the minimum time of impact will be added to the results list.

        Bodies in collision with the given convex at the beginning of the cast are not included in the results.

        Parameters:
        convex - the convex to cast
        transform - the initial position and orientation of the convex
        deltaPosition - Δposition; the change in position (the cast length and direction basically)
        deltaAngle - Δangle; the change in the angle; this is the change in the angle over the linear period
        ignoreSensors - true if sensor fixtures should be ignored in the tests
        ignoreInactive - true if inactive bodies should be ignored in the tests
        all - true if all hits should be returned; false if only the first should be returned
        results - the list to add the results to
        Returns:
        boolean true if a collision was found
        Since:
        3.1.9
      • convexCast

        public boolean convexCast​(Convex convex,
                                  Transform transform,
                                  Vector2 deltaPosition,
                                  double deltaAngle,
                                  Filter filter,
                                  boolean ignoreSensors,
                                  boolean ignoreInactive,
                                  boolean all,
                                  List<ConvexCastResult> results)
        Deprecated.
        Performs a linear convex cast on the world, placing any detected collisions into the given results list.

        This method does a static test of bodies (in other words, does not take into account the bodies linear or angular velocity, but rather assumes they are stationary).

        The deltaPosition parameter is the linear cast vector determining the direction and magnitude of the cast. The deltaAngle parameter is the change in angle over the linear cast and is interpolated linearly during detection.

        The ConvexCastResult class implements the Comparable interface to allow sorting by the time of impact.

        If the all flag is false, the results list will only contain the closest result (if any).

        All convex casts pass through the ConvexCastListeners before being tested. If any ConvexCastListener doesn't allow the convex cast, then the body will not be tested.

        For multi-fixtured bodies, only the fixture that has the minimum time of impact will be added to the results list.

        Bodies in collision with the given convex at the beginning of the cast are not included in the results.

        Parameters:
        convex - the convex to cast
        transform - the initial position and orientation of the convex
        deltaPosition - Δposition; the change in position (the cast length and direction basically)
        deltaAngle - Δangle; the change in the angle; this is the change in the angle over the linear period
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor fixtures should be ignored in the tests
        ignoreInactive - true if inactive bodies should be ignored in the tests
        all - true if all hits should be returned; false if only the first should be returned
        results - the list to add the results to
        Returns:
        boolean true if a collision was found
        Since:
        3.1.9
      • convexCast

        public boolean convexCast​(Convex convex,
                                  Transform transform,
                                  Vector2 deltaPosition,
                                  Body body,
                                  boolean ignoreSensors,
                                  ConvexCastResult result)
        Deprecated.
        Performs a linear convex cast on the given body, placing a detected collision into the given result object.

        This method does a static test of the body (in other words, does not take into account the body's linear or angular velocity, but rather assumes it is stationary).

        The deltaPosition parameter is the linear cast vector determining the direction and magnitude of the cast.

        All convex casts pass through the ConvexCastListeners before being tested. If any ConvexCastListener doesn't allow the convex cast, then the body will not be tested.

        For multi-fixtured bodies, the fixture that has the minimum time of impact will be the result.

        Returns false if the given body and convex are in collision at the beginning of the cast.

        Parameters:
        convex - the convex to cast
        transform - the initial position and orientation of the convex
        deltaPosition - Δposition; the change in position (the cast length and direction basically)
        body - the body to cast against
        ignoreSensors - true if sensor fixtures should be ignored in the tests
        result - the convex cast result
        Returns:
        boolean true if a collision was found
        Since:
        3.1.5
      • convexCast

        public boolean convexCast​(Convex convex,
                                  Transform transform,
                                  Vector2 deltaPosition,
                                  double deltaAngle,
                                  Body body,
                                  boolean ignoreSensors,
                                  ConvexCastResult result)
        Deprecated.
        Performs a linear convex cast on the given body, placing a detected collision into the given result object.

        This method does a static test of the body (in other words, does not take into account the body's linear or angular velocity, but rather assumes it is stationary).

        The deltaPosition parameter is the linear cast vector determining the direction and magnitude of the cast. The deltaAngle parameter is the change in angle over the linear cast and is interpolated linearly during detection.

        All convex casts pass through the ConvexCastListeners before being tested. If any ConvexCastListener doesn't allow the convex cast, then the body will not be tested.

        For multi-fixtured bodies, the fixture that has the minimum time of impact will be the result.

        Returns false if the given body and convex are in collision at the beginning of the cast.

        Parameters:
        convex - the convex to cast
        transform - the initial position and orientation of the convex
        deltaPosition - Δposition; the change in position (the cast length and direction basically)
        deltaAngle - Δangle; the change in the angle; this is the change in the angle over the linear period
        body - the body to cast against
        ignoreSensors - true if sensor fixtures should be ignored in the tests
        result - the convex cast result
        Returns:
        boolean true if a collision was found
        Since:
        3.1.5
      • convexCast

        public boolean convexCast​(Convex convex,
                                  Transform transform,
                                  Vector2 deltaPosition,
                                  double deltaAngle,
                                  Body body,
                                  Filter filter,
                                  boolean ignoreSensors,
                                  ConvexCastResult result)
        Deprecated.
        Performs a linear convex cast on the given body, placing a detected collision into the given result object.

        This method does a static test of the body (in other words, does not take into account the body's linear or angular velocity, but rather assumes it is stationary).

        The deltaPosition parameter is the linear cast vector determining the direction and magnitude of the cast. The deltaAngle parameter is the change in angle over the linear cast and is interpolated linearly during detection.

        All convex casts pass through the ConvexCastListeners before being tested. If any ConvexCastListener doesn't allow the convex cast, then the body will not be tested.

        For multi-fixtured bodies, the fixture that has the minimum time of impact will be the result.

        Returns false if the given body and convex are in collision at the beginning of the cast.

        Parameters:
        convex - the convex to cast
        transform - the initial position and orientation of the convex
        deltaPosition - Δposition; the change in position (the cast length and direction basically)
        deltaAngle - Δangle; the change in the angle; this is the change in the angle over the linear period
        body - the body to cast against
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor fixtures should be ignored in the tests
        result - the convex cast result
        Returns:
        boolean true if a collision was found
        Since:
        3.1.9
      • detect

        public boolean detect​(AABB aabb,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given AABB overlaps a Body in this World.

        If any part of a body is overlaping the AABB, the body is added to the list.

        This performs a static collision test of the world using the BroadphaseDetector.

        This may return bodies who only have sensor fixtures overlapping.

        Inactive bodies are ignored in this test.

        Parameters:
        aabb - the world space AABB
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if the AABB overlaps any body
        Since:
        3.1.9
      • detect

        public boolean detect​(AABB aabb,
                              boolean ignoreInactive,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given AABB overlaps a Body Fixture in this World.

        If any part of a body is overlaping the AABB, the body and that respective fixture is added to the returned list.

        This performs a static collision test of the world using the BroadphaseDetector.

        This may return bodies who only have sensor fixtures overlapping.

        Parameters:
        aabb - the world space AABB
        ignoreInactive - true if inactive bodies should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if the AABB overlaps any body
        Since:
        3.1.9
      • detect

        public boolean detect​(AABB aabb,
                              boolean ignoreSensors,
                              boolean ignoreInactive,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given AABB overlaps a Body in this World.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Parameters:
        aabb - the world space AABB
        ignoreSensors - true if sensor fixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if the AABB overlaps any fixture
        Since:
        3.1.9
      • detect

        public boolean detect​(AABB aabb,
                              Filter filter,
                              boolean ignoreSensors,
                              boolean ignoreInactive,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given AABB overlaps a Body in this World.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Parameters:
        aabb - the world space AABB
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor fixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if the AABB overlaps any fixture
        Since:
        3.1.9
      • detect

        public boolean detect​(Convex convex,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps a body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        The returned results may include sensor fixutres.

        Inactive bodies are ignored in this test.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the convex shape in world coordinates
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
        See Also:
        detect(Convex, boolean, List)
      • detect

        public boolean detect​(Convex convex,
                              boolean ignoreSensors,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps a body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        Inactive bodies are ignored in this test.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the convex shape in world coordinates
        ignoreSensors - true if sensor fixtures should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
        See Also:
        detect(Convex, boolean, boolean, List)
      • detect

        public boolean detect​(Convex convex,
                              boolean ignoreSensors,
                              boolean ignoreInactive,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps a body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the convex shape in world coordinates
        ignoreSensors - true if sensor fixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
        See Also:
        detect(Convex, Transform, Filter, boolean, boolean, List)
      • detect

        public boolean detect​(Convex convex,
                              Filter filter,
                              boolean ignoreSensors,
                              boolean ignoreInactive,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps a body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the convex shape in world coordinates
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor fixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
        See Also:
        detect(Convex, Transform, Filter, boolean, boolean, boolean, List)
      • detect

        public boolean detect​(Convex convex,
                              Filter filter,
                              boolean ignoreSensors,
                              boolean ignoreInactive,
                              boolean includeCollisionData,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps a body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        Use the includeCollisionData parameter to have the Penetration object filled in the DetectResults. Including this information will have a performance impact.

        Parameters:
        convex - the convex shape in world coordinates
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor fixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        includeCollisionData - true if the overlap Penetration should be returned
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
      • detect

        public boolean detect​(Convex convex,
                              Transform transform,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps a body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        The returned results may include sensor fixutres.

        Inactive bodies are ignored in this test.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the convex shape in local coordinates
        transform - the convex shape's world transform
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
        See Also:
        detect(Convex, Transform, boolean, List)
      • detect

        public boolean detect​(Convex convex,
                              Transform transform,
                              boolean ignoreSensors,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps a body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        Inactive bodies are ignored in this test.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the convex shape in local coordinates
        transform - the convex shape's world transform
        ignoreSensors - true if sensor fixtures should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
        See Also:
        detect(Convex, Transform, boolean, boolean, List)
      • detect

        public boolean detect​(Convex convex,
                              Transform transform,
                              boolean ignoreSensors,
                              boolean ignoreInactive,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps a body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the convex shape in local coordinates
        transform - the convex shape's world transform
        ignoreSensors - true if sensor fixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
        See Also:
        detect(Convex, Transform, Filter, boolean, boolean, List)
      • detect

        public boolean detect​(Convex convex,
                              Transform transform,
                              Filter filter,
                              boolean ignoreSensors,
                              boolean ignoreInactive,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps a body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the convex shape in local coordinates
        transform - the convex shape's world transform
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor fixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
        See Also:
        detect(Convex, Transform, Filter, boolean, boolean, boolean, List)
      • detect

        public boolean detect​(Convex convex,
                              Transform transform,
                              Filter filter,
                              boolean ignoreSensors,
                              boolean ignoreInactive,
                              boolean includeCollisionData,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps a body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        Use the includeCollisionData parameter to have the Penetration object filled in the DetectResults. Including this information will have a performance impact.

        Parameters:
        convex - the convex shape in local coordinates
        transform - the convex shape's world transform
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor fixtures should be ignored
        ignoreInactive - true if inactive bodies should be ignored
        includeCollisionData - true if the overlap Penetration should be returned
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
      • detect

        public boolean detect​(AABB aabb,
                              Body body,
                              boolean ignoreSensors,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given AABB overlaps the given body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the AABB overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        Parameters:
        aabb - the AABB in world coordinates
        body - the Body to test against
        ignoreSensors - true if sensor fixtures should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
      • detect

        public boolean detect​(AABB aabb,
                              Body body,
                              Filter filter,
                              boolean ignoreSensors,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given AABB overlaps the given body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the AABB overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        Parameters:
        aabb - the AABB in world coordinates
        body - the Body to test against
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor fixtures should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
      • detect

        public boolean detect​(Convex convex,
                              Body body,
                              boolean ignoreSensors,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps the given body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the Convex in world coordinates
        body - the Body to test against
        ignoreSensors - true if sensor fixtures should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
      • detect

        public boolean detect​(Convex convex,
                              Body body,
                              Filter filter,
                              boolean ignoreSensors,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps the given body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the Convex in world coordinates
        body - the Body to test against
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor fixtures should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
      • detect

        public boolean detect​(Convex convex,
                              Body body,
                              Filter filter,
                              boolean ignoreSensors,
                              boolean includeCollisionData,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps the given body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        Use the includeCollisionData parameter to have the Penetration object filled in the DetectResults. Including this information negatively impacts performance.

        Parameters:
        convex - the Convex in world coordinates
        body - the Body to test against
        filter - the Filter to use against the fixtures; can be null
        includeCollisionData - true if the overlap Penetration should be returned
        ignoreSensors - true if sensor fixtures should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
      • detect

        public boolean detect​(Convex convex,
                              Transform transform,
                              Body body,
                              boolean ignoreSensors,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps the given body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the Convex in local coordinates
        transform - the convex shape's world Transform
        body - the Body to test against
        ignoreSensors - true if sensor fixtures should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
      • detect

        public boolean detect​(Convex convex,
                              Transform transform,
                              Body body,
                              Filter filter,
                              boolean ignoreSensors,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps the given body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        The results from this test will not include Penetration objects.

        Parameters:
        convex - the Convex in local coordinates
        transform - the convex shape's world Transform
        body - the Body to test against
        filter - the Filter to use against the fixtures; can be null
        ignoreSensors - true if sensor fixtures should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
      • detect

        public boolean detect​(Convex convex,
                              Transform transform,
                              Body body,
                              Filter filter,
                              boolean ignoreSensors,
                              boolean includeCollisionData,
                              List<DetectResult> results)
        Deprecated.
        Returns true if the given Convex overlaps the given body in the world.

        If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.

        Use the Body.isInContact(Body) method instead if you want to test if two bodies are colliding.

        Use the includeCollisionData parameter to have the Penetration object filled in the DetectResults. Including this information negatively impacts performance.

        Parameters:
        convex - the Convex in local coordinates
        transform - the convex shape's world Transform
        body - the Body to test against
        filter - the Filter to use against the fixtures; can be null
        includeCollisionData - true if the overlap Penetration should be returned
        ignoreSensors - true if sensor fixtures should be ignored
        results - the list of overlapping bodies and fixtures
        Returns:
        boolean true if an overlap was found
        Since:
        3.1.9
      • shift

        public void shift​(Vector2 shift)
        Deprecated.
        Shifts the coordinates of the entire world by the given amount.
         NewPosition = OldPosition + shift
         
        This method is useful in situations where the world is very large causing very large numbers to be used in the computations. Shifting the coordinate system allows the computations to be localized and retain accuracy.

        This method modifies the coordinates of every body and joint in the world.

        Adding joints or bodies after this method is called should consider that everything has been shifted.

        This method does NOT require a call to setUpdateRequired(boolean).

        Specified by:
        shift in interface Shiftable
        Parameters:
        shift - the distance to shift along the x and y axes
        Since:
        3.2.0
      • containsBody

        public boolean containsBody​(Body body)
        Deprecated.
        Returns true if this world contains the given body.
        Parameters:
        body - the Body to test for
        Returns:
        boolean true if the body is contained in this world
        Since:
        3.1.1
      • containsJoint

        public boolean containsJoint​(Joint joint)
        Deprecated.
        Returns true if this world contains the given joint.
        Parameters:
        joint - the Joint to test for
        Returns:
        boolean true if the joint is contained in this world
        Since:
        3.1.1
      • removeBody

        public boolean removeBody​(int index)
        Deprecated.
        Removes the Body at the given index from this World.

        Use the removeBody(int, boolean) method to enable implicit destruction notification.

        Parameters:
        index - the index of the body to remove.
        Returns:
        boolean true if the body was removed
        Since:
        3.2.0
      • removeBody

        public boolean removeBody​(int index,
                                  boolean notify)
        Deprecated.
        Removes the Body at the given index from this World.

        When a body is removed, joints and contacts may be implicitly destroyed. Pass true to the notify parameter to be notified of the destruction of these objects via the DestructionListeners.

        This method does not trigger ContactListener.end(ContactPoint) events for the contacts that are being removed.

        Parameters:
        index - the index of the body to remove.
        notify - true if implicit destruction should be notified
        Returns:
        boolean true if the body was removed
        Since:
        3.2.0
      • removeBody

        public boolean removeBody​(Body body)
        Deprecated.
        Removes the given Body from this World.

        Use the removeBody(Body, boolean) method to enable implicit destruction notification.

        Parameters:
        body - the Body to remove.
        Returns:
        boolean true if the body was removed
      • removeBody

        public boolean removeBody​(Body body,
                                  boolean notify)
        Deprecated.
        Removes the given Body from this World.

        When a body is removed, joints and contacts may be implicitly destroyed. Pass true to the notify parameter to be notified of the destruction of these objects via the DestructionListeners.

        This method does not trigger ContactListener.end(ContactPoint) events for the contacts that are being removed.

        Parameters:
        body - the Body to remove
        notify - true if implicit destruction should be notified
        Returns:
        boolean true if the body was removed
        Since:
        3.1.1
      • removeJoint

        public boolean removeJoint​(int index)
        Deprecated.
        Removes the Joint at the given index from this World.

        No other objects are implicitly destroyed with joints are removed.

        Parameters:
        index - the index of the Joint to remove
        Returns:
        boolean true if the Joint was removed
        Since:
        3.2.0
      • removeJoint

        public boolean removeJoint​(Joint joint)
        Deprecated.
        Removes the given Joint from this World.

        No other objects are implicitly destroyed with joints are removed.

        Parameters:
        joint - the Joint to remove
        Returns:
        boolean true if the Joint was removed
      • removeAllBodiesAndJoints

        public void removeAllBodiesAndJoints()
        Deprecated.
        Removes all the joints and bodies from this world.

        This method does not notify of destroyed objects.

        Since:
        3.1.1
        See Also:
        removeAllBodiesAndJoints(boolean)
      • removeAllBodiesAndJoints

        public void removeAllBodiesAndJoints​(boolean notify)
        Deprecated.
        Removes all the joints and bodies from this world.
        Parameters:
        notify - true if destruction of joints and contacts should be notified of by the DestructionListener
        Since:
        3.1.1
      • removeAllBodies

        public void removeAllBodies()
        Deprecated.
        This is a convenience method for the removeAllBodiesAndJoints() method since all joints will be removed when all bodies are removed anyway.

        This method does not notify of the destroyed contacts, joints, etc.

        Since:
        3.0.1
        See Also:
        removeAllBodies(boolean)
      • removeAllBodies

        public void removeAllBodies​(boolean notify)
        Deprecated.
        This is a convenience method for the removeAllBodiesAndJoints(boolean) method since all joints will be removed when all bodies are removed anyway.
        Parameters:
        notify - true if destruction of joints and contacts should be notified of by the DestructionListener
        Since:
        3.0.1
      • removeAllJoints

        public void removeAllJoints()
        Deprecated.
        Removes all Joints from this World.

        This method does not notify of the joints removed.

        Since:
        3.0.1
        See Also:
        removeAllJoints(boolean)
      • removeAllJoints

        public void removeAllJoints​(boolean notify)
        Deprecated.
        Removes all Joints from this World.
        Parameters:
        notify - true if destruction of joints should be notified of by the DestructionListener
        Since:
        3.0.1
      • isUpdateRequired

        public boolean isUpdateRequired()
        Deprecated.
        Returns true if upon the next time step the contacts must be updated.

        This is typically set via user code when something about the simulation changes that can affect collision detection.

        Returns:
        boolean
        See Also:
        setUpdateRequired(boolean)
      • setUpdateRequired

        public void setUpdateRequired​(boolean flag)
        Deprecated.
        Sets the update required flag.

        Set this flag to true if any of the following conditions have been met:

        • If a Body has been added or removed from the World
        • If a Body has been translated or rotated
        • If a Body's state has been manually changed via the Body.setActive(boolean) method
        • If a BodyFixture has been added or removed from a Body
        • If a BodyFixture's sensor flag has been manually changed via the BodyFixture.setSensor(boolean) method
        • If a BodyFixture's filter has been manually changed via the BodyFixture.setFilter(boolean) method
        • If a BodyFixture's restitution or friction coefficient has changed
        • If a BodyFixture's Shape has been translated or rotated
        • If a BodyFixture's Shape has been changed (vertices, radius, etc.)
        • If a Body's type has changed to or from Static (this is caused by the using setMassType(Mass.INFINITE/Mass.NORMAL) method)
        • If a Joint has been added or removed from the World in which the joined bodies should not be allowed to collide
        • If the World's CoefficientMixer has been changed
        Parameters:
        flag - the flag
      • getSettings

        public Settings getSettings()
        Deprecated.
        Returns the settings for this world.
        Returns:
        Settings
        Since:
        3.0.3
      • setSettings

        public void setSettings​(Settings settings)
        Deprecated.
        Sets the dynamics settings for this world.
        Parameters:
        settings - the desired settings
        Throws:
        NullPointerException - if the given settings is null
        Since:
        3.0.3
      • setGravity

        public void setGravity​(Vector2 gravity)
        Deprecated.
        Sets the acceleration due to gravity.
        Parameters:
        gravity - the gravity in meters/second2
        Throws:
        NullPointerException - if gravity is null
      • getGravity

        public Vector2 getGravity()
        Deprecated.
        Returns the acceleration due to gravity.
        Returns:
        Vector2 the gravity in meters/second2
      • setBounds

        public void setBounds​(Bounds bounds)
        Deprecated.
        Sets the bounds of this World.
        Parameters:
        bounds - the bounds; can be null
      • getBounds

        public Bounds getBounds()
        Deprecated.
        Returns the bounds of this world.

        This will return null if no bounds were initially set or if it was set to null via the setBounds(Bounds) method.

        Returns:
        Bounds the bounds or null
      • getListeners

        public <T extends ListenerList<T> getListeners​(Class<T> clazz)
        Deprecated.
        Returns the listeners that are of the given type (or sub types) of the given type.

        Returns an empty list if no listeners for the given type are found.

        Returns null if clazz is null.

        Example usage:

         world.getListeners(ContactListener.class);
         
        Type Parameters:
        T - the listener type
        Parameters:
        clazz - the type of listener to get
        Returns:
        List<T>
        Since:
        3.1.0
      • getListeners

        public <T extends Listener> void getListeners​(Class<T> clazz,
                                                      List<T> listeners)
        Deprecated.
        Returns the listeners of the given type (or sub types) in the given list.

        This method does not clear the given listeners list before adding the listeners.

        If clazz or listeners is null, this method immediately returns.

        Example usage:

         List<ContactListener> list = ...;
         world.getListeners(ContactListener.class, list);
         
        Type Parameters:
        T - the listener type
        Parameters:
        clazz - the type of listener to get
        listeners - the list to add the listeners to
        Since:
        3.1.1
      • addListener

        public void addListener​(Listener listener)
        Deprecated.
        Adds the given listener to the list of listeners.
        Parameters:
        listener - the listener
        Throws:
        NullPointerException - if the given listener is null
        IllegalArgumentException - if the given listener has already been added to this world
        Since:
        3.1.0
      • containsListener

        public boolean containsListener​(Listener listener)
        Deprecated.
        Returns true if the given listener is already attached to this world.
        Parameters:
        listener - the listener
        Returns:
        boolean
        Since:
        3.1.1
      • removeListener

        public boolean removeListener​(Listener listener)
        Deprecated.
        Removes the given listener from this world.
        Parameters:
        listener - the listener to remove
        Returns:
        boolean true if the listener was removed
        Since:
        3.1.0
      • removeAllListeners

        public int removeAllListeners()
        Deprecated.
        Removes all the listeners.
        Returns:
        int the number of listeners removed
        Since:
        3.1.1
      • removeAllListeners

        public <T extends Listener> int removeAllListeners​(Class<T> clazz)
        Deprecated.
        Removes all the listeners of the specified type (or sub types).

        Returns zero if the given type is null or there are zero listeners attached.

        Example usage:

         world.removeAllListeners(ContactListener.class);
         
        Type Parameters:
        T - the listener type
        Parameters:
        clazz - the listener type
        Returns:
        int the number of listeners removed
        Since:
        3.1.1
      • getListenerCount

        public int getListenerCount()
        Deprecated.
        Returns the total number of listeners attached to this world.
        Returns:
        int
        Since:
        3.1.1
      • getListenerCount

        public <T extends Listener> int getListenerCount​(Class<T> clazz)
        Deprecated.
        Returns the total number of listeners of the given type (or sub types) attached to this world.

        Returns zero if the given class type is null.

        Example usage:

         world.getListenerCount(BoundsListener.class);
         
        Type Parameters:
        T - the listener type
        Parameters:
        clazz - the listener type
        Returns:
        int
        Since:
        3.1.1
      • setBroadphaseDetector

        public void setBroadphaseDetector​(BroadphaseDetector<Body,​BodyFixture> broadphaseDetector)
        Deprecated.
        Sets the broad-phase collision detection algorithm.
        Parameters:
        broadphaseDetector - the broad-phase collision detection algorithm
        Throws:
        NullPointerException - if broadphaseDetector is null
      • setDetectBroadphaseFilter

        public void setDetectBroadphaseFilter​(BroadphaseFilter<Body,​BodyFixture> filter)
        Deprecated.
        Sets the BroadphaseFilter used when detecting collisions for each time step.

        This should always be an instance of a class that extends the DetectBroadphaseFilter so that the standard filters are retained.

        Parameters:
        filter - the filter
        Since:
        3.2.2
      • setNarrowphaseDetector

        public void setNarrowphaseDetector​(NarrowphaseDetector narrowphaseDetector)
        Deprecated.
        Sets the narrow-phase collision detection algorithm.
        Parameters:
        narrowphaseDetector - the narrow-phase collision detection algorithm
        Throws:
        NullPointerException - if narrowphaseDetector is null
      • getNarrowphaseDetector

        public NarrowphaseDetector getNarrowphaseDetector()
        Deprecated.
        Returns the narrow-phase collision detection algorithm.
        Returns:
        NarrowphaseDetector the narrow-phase collision detection algorithm
      • setManifoldSolver

        public void setManifoldSolver​(ManifoldSolver manifoldSolver)
        Deprecated.
        Sets the manifold solver.
        Parameters:
        manifoldSolver - the manifold solver
        Throws:
        NullPointerException - if manifoldSolver is null
      • getManifoldSolver

        public ManifoldSolver getManifoldSolver()
        Deprecated.
        Returns the manifold solver.
        Returns:
        ManifoldSolver the manifold solver
      • setTimeOfImpactDetector

        public void setTimeOfImpactDetector​(TimeOfImpactDetector timeOfImpactDetector)
        Deprecated.
        Sets the time of impact detector.
        Parameters:
        timeOfImpactDetector - the time of impact detector
        Throws:
        NullPointerException - if timeOfImpactDetector is null
        Since:
        1.2.0
      • getTimeOfImpactDetector

        public TimeOfImpactDetector getTimeOfImpactDetector()
        Deprecated.
        Returns the time of impact detector.
        Returns:
        TimeOfImpactDetector the time of impact detector
        Since:
        1.2.0
      • setRaycastDetector

        public void setRaycastDetector​(RaycastDetector raycastDetector)
        Deprecated.
        Sets the raycast detector.
        Parameters:
        raycastDetector - the raycast detector
        Throws:
        NullPointerException - if raycastDetector is null
        Since:
        2.0.0
      • getRaycastDetector

        public RaycastDetector getRaycastDetector()
        Deprecated.
        Returns the raycast detector.
        Returns:
        RaycastDetector the raycast detector
        Since:
        2.0.0
      • getUserData

        public Object getUserData()
        Deprecated.
        Description copied from interface: DataContainer
        Gets the custom user data.
        Specified by:
        getUserData in interface DataContainer
        Returns:
        Object will return null if not set
      • setUserData

        public void setUserData​(Object userData)
        Deprecated.
        Description copied from interface: DataContainer
        Sets the custom user data to the given data.
        Specified by:
        setUserData in interface DataContainer
        Parameters:
        userData - the user data
      • getBodyCount

        public int getBodyCount()
        Deprecated.
        Returns the number of Bodys in this World.
        Returns:
        int the number of bodies
      • getBody

        public Body getBody​(int index)
        Deprecated.
        Returns the Body at the given index.
        Parameters:
        index - the index
        Returns:
        Body
      • getBodies

        public List<Body> getBodies()
        Deprecated.
        Returns an unmodifiable list containing all the bodies in this world.

        The returned list is backed by the internal list, therefore adding or removing bodies while iterating through the returned list is not permitted. Use the getBodyIterator() method instead.

        Returns:
        List<Body>
        Since:
        3.1.5
        See Also:
        getBodyIterator()
      • getBodyIterator

        public Iterator<Body> getBodyIterator()
        Deprecated.
        Returns an iterator for iterating over the bodies in this world.

        The returned iterator supports the remove method.

        Returns:
        Iterator<Body>
        Since:
        3.2.0
      • getJointCount

        public int getJointCount()
        Deprecated.
        Returns the number of Joints in this World.
        Returns:
        int the number of joints
      • getJoint

        public Joint getJoint​(int index)
        Deprecated.
        Returns the Joint at the given index.
        Parameters:
        index - the index
        Returns:
        Joint
      • getJoints

        public List<Joint> getJoints()
        Deprecated.
        Returns an unmodifiable list containing all the joints in this world.

        The returned list is backed by the internal list, therefore adding or removing joints while iterating through the returned list is not permitted. Use the getJointIterator() method instead.

        Returns:
        List<Joint>
        Since:
        3.1.5
        See Also:
        getJointIterator()
      • getJointIterator

        public Iterator<Joint> getJointIterator()
        Deprecated.
        Returns an iterator for iterating over the joints in this world.

        The returned iterator supports the remove method.

        Returns:
        Iterator<Joint>
        Since:
        3.2.0
      • getStep

        public Step getStep()
        Deprecated.
        Returns the Step object used to advance the simulation.

        The returned object contains the step information (elapsed time) for the last and the previous time step.

        Returns:
        Step the current step object
      • isEmpty

        public boolean isEmpty()
        Deprecated.
        Returns true if this world doesn't contain any bodies or joints.
        Returns:
        boolean
        Since:
        3.0.1
      • getAccumulatedTime

        public double getAccumulatedTime()
        Deprecated.
        Returns the current accumulated time.

        This is the time that has elapsed since the last step of the engine.

        This time is used and/or accumulated on each call of the update(double) and update(double, int) methods.

        This time is reduced by the step frequency for each step of the engine.

        Returns:
        double
        Since:
        3.1.10
      • setAccumulatedTime

        public void setAccumulatedTime​(double elapsedTime)
        Deprecated.
        Sets the current accumulated time.

        A typical use case would be to throw away any remaining time that the update(double) or update(double, int) methods didn't use:

         boolean updated = world.update(elapsedTime);
         // the check if the world actually updated is crutial in this example
         if (updated) {
                // throw away any remaining time we didnt use
                world.setAccumulatedTime(0);
         }
         
        Or, in the case of reusing the same World object, you could use this method to clear any accumulated time.

        If elapsedTime is less than zero, this method immediately returns.

        Parameters:
        elapsedTime - the desired elapsed time
        Since:
        3.1.10
        See Also:
        getAccumulatedTime()