- Object
-
- 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, aWorld
instance can have multiple listeners for all the listener types. Some listener types return a boolean to indicate continuing or allowing something, likeCollisionListener
. If, for example, there are multipleCollisionListener
s 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 Summary
Fields Modifier and Type Field Description static Vector2
EARTH_GRAVITY
Deprecated.Earths gravity constantstatic Vector2
ZERO_GRAVITY
Deprecated.Zero gravity constant
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addBody(Body body)
Deprecated.void
addJoint(Joint joint)
Deprecated.void
addListener(Listener listener)
Deprecated.Adds the given listener to the list of listeners.boolean
containsBody(Body body)
Deprecated.Returns true if this world contains the given body.boolean
containsJoint(Joint joint)
Deprecated.Returns true if this world contains the given joint.boolean
containsListener(Listener listener)
Deprecated.Returns true if the given listener is already attached to this world.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.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.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.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.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.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.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.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.boolean
detect(AABB aabb, boolean ignoreSensors, boolean ignoreInactive, List<DetectResult> results)
Deprecated.boolean
detect(AABB aabb, boolean ignoreInactive, List<DetectResult> results)
Deprecated.boolean
detect(AABB aabb, List<DetectResult> results)
Deprecated.boolean
detect(AABB aabb, Filter filter, boolean ignoreSensors, boolean ignoreInactive, List<DetectResult> results)
Deprecated.boolean
detect(AABB aabb, Body body, boolean ignoreSensors, List<DetectResult> results)
Deprecated.Returns true if the givenAABB
overlaps the given body in the world.boolean
detect(AABB aabb, Body body, Filter filter, boolean ignoreSensors, List<DetectResult> results)
Deprecated.Returns true if the givenAABB
overlaps the given body in the world.boolean
detect(Convex convex, boolean ignoreSensors, boolean ignoreInactive, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps a body in the world.boolean
detect(Convex convex, boolean ignoreSensors, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps a body in the world.boolean
detect(Convex convex, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps a body in the world.boolean
detect(Convex convex, Filter filter, boolean ignoreSensors, boolean ignoreInactive, boolean includeCollisionData, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps a body in the world.boolean
detect(Convex convex, Filter filter, boolean ignoreSensors, boolean ignoreInactive, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps a body in the world.boolean
detect(Convex convex, Body body, boolean ignoreSensors, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps the given body in the world.boolean
detect(Convex convex, Body body, Filter filter, boolean ignoreSensors, boolean includeCollisionData, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps the given body in the world.boolean
detect(Convex convex, Body body, Filter filter, boolean ignoreSensors, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps the given body in the world.boolean
detect(Convex convex, Transform transform, boolean ignoreSensors, boolean ignoreInactive, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps a body in the world.boolean
detect(Convex convex, Transform transform, boolean ignoreSensors, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps a body in the world.boolean
detect(Convex convex, Transform transform, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps a body in the world.boolean
detect(Convex convex, Transform transform, Filter filter, boolean ignoreSensors, boolean ignoreInactive, boolean includeCollisionData, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps a body in the world.boolean
detect(Convex convex, Transform transform, Filter filter, boolean ignoreSensors, boolean ignoreInactive, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps a body in the world.boolean
detect(Convex convex, Transform transform, Body body, boolean ignoreSensors, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps the given body in the world.boolean
detect(Convex convex, Transform transform, Body body, Filter filter, boolean ignoreSensors, boolean includeCollisionData, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps the given body in the world.boolean
detect(Convex convex, Transform transform, Body body, Filter filter, boolean ignoreSensors, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
overlaps the given body in the world.double
getAccumulatedTime()
Deprecated.Returns the current accumulated time.List<Body>
getBodies()
Deprecated.Returns an unmodifiable list containing all the bodies in this world.Body
getBody(int index)
Deprecated.Returns theBody
at the given index.int
getBodyCount()
Deprecated.Iterator<Body>
getBodyIterator()
Deprecated.Returns an iterator for iterating over the bodies in this world.Bounds
getBounds()
Deprecated.Returns the bounds of this world.BroadphaseDetector<Body,BodyFixture>
getBroadphaseDetector()
Deprecated.Returns the broad-phase collision detection algorithm.CoefficientMixer
getCoefficientMixer()
Deprecated.Returns theCoefficientMixer
.ContactConstraintSolver
getContactConstraintSolver()
Deprecated.Returns theContactConstraintSolver
.ContactManager
getContactManager()
Deprecated.Returns theContactManager
.BroadphaseFilter<Body,BodyFixture>
getDetectBroadphaseFilter()
Deprecated.Returns theBroadphaseFilter
used when detecting collisions for each time step.Vector2
getGravity()
Deprecated.Returns the acceleration due to gravity.Joint
getJoint(int index)
Deprecated.Returns theJoint
at the given index.int
getJointCount()
Deprecated.Iterator<Joint>
getJointIterator()
Deprecated.Returns an iterator for iterating over the joints in this world.List<Joint>
getJoints()
Deprecated.Returns an unmodifiable list containing all the joints in this world.int
getListenerCount()
Deprecated.Returns the total number of listeners attached to this world.<T extends Listener>
intgetListenerCount(Class<T> clazz)
Deprecated.Returns the total number of listeners of the given type (or sub types) attached to this world.<T extends Listener>
List<T>getListeners(Class<T> clazz)
Deprecated.Returns the listeners that are of the given type (or sub types) of the given type.<T extends Listener>
voidgetListeners(Class<T> clazz, List<T> listeners)
Deprecated.Returns the listeners of the given type (or sub types) in the given list.ManifoldSolver
getManifoldSolver()
Deprecated.Returns the manifold solver.NarrowphaseDetector
getNarrowphaseDetector()
Deprecated.Returns the narrow-phase collision detection algorithm.RaycastDetector
getRaycastDetector()
Deprecated.Returns the raycast detector.Settings
getSettings()
Deprecated.Returns the settings for this world.Step
getStep()
Deprecated.Returns theStep
object used to advance the simulation.TimeOfImpactDetector
getTimeOfImpactDetector()
Deprecated.Returns the time of impact detector.Object
getUserData()
Deprecated.Gets the custom user data.boolean
isEmpty()
Deprecated.Returns true if this world doesn't contain any bodies or joints.boolean
isUpdateRequired()
Deprecated.Returns true if upon the next time step the contacts must be updated.boolean
raycast(Ray ray, double maxLength, boolean ignoreSensors, boolean ignoreInactive, boolean all, List<RaycastResult> results)
Deprecated.boolean
raycast(Ray ray, double maxLength, boolean ignoreSensors, boolean all, List<RaycastResult> results)
Deprecated.boolean
raycast(Ray ray, double maxLength, Filter filter, boolean ignoreSensors, boolean ignoreInactive, boolean all, List<RaycastResult> results)
Deprecated.boolean
raycast(Ray ray, Body body, double maxLength, boolean ignoreSensors, RaycastResult result)
Deprecated.Performs a raycast against the givenBody
and returns true if the ray intersects the body.boolean
raycast(Ray ray, Body body, double maxLength, Filter filter, boolean ignoreSensors, RaycastResult result)
Deprecated.Performs a raycast against the givenBody
and returns true if the ray intersects the body.boolean
raycast(Vector2 start, Vector2 end, boolean ignoreSensors, boolean ignoreInactive, boolean all, List<RaycastResult> results)
Deprecated.boolean
raycast(Vector2 start, Vector2 end, boolean ignoreSensors, boolean all, List<RaycastResult> results)
Deprecated.boolean
raycast(Vector2 start, Vector2 end, Filter filter, boolean ignoreSensors, boolean ignoreInactive, boolean all, List<RaycastResult> results)
Deprecated.boolean
raycast(Vector2 start, Vector2 end, Body body, boolean ignoreSensors, RaycastResult result)
Deprecated.Performs a raycast against the givenBody
and returns true if the ray intersects the body.boolean
raycast(Vector2 start, Vector2 end, Body body, Filter filter, boolean ignoreSensors, RaycastResult result)
Deprecated.Performs a raycast against the givenBody
and returns true if the ray intersects the body.void
removeAllBodies()
Deprecated.This is a convenience method for theremoveAllBodiesAndJoints()
method since all joints will be removed when all bodies are removed anyway.void
removeAllBodies(boolean notify)
Deprecated.This is a convenience method for theremoveAllBodiesAndJoints(boolean)
method since all joints will be removed when all bodies are removed anyway.void
removeAllBodiesAndJoints()
Deprecated.Removes all the joints and bodies from this world.void
removeAllBodiesAndJoints(boolean notify)
Deprecated.Removes all the joints and bodies from this world.void
removeAllJoints()
Deprecated.void
removeAllJoints(boolean notify)
Deprecated.int
removeAllListeners()
Deprecated.Removes all the listeners.<T extends Listener>
intremoveAllListeners(Class<T> clazz)
Deprecated.Removes all the listeners of the specified type (or sub types).boolean
removeBody(int index)
Deprecated.boolean
removeBody(int index, boolean notify)
Deprecated.boolean
removeBody(Body body)
Deprecated.boolean
removeBody(Body body, boolean notify)
Deprecated.boolean
removeJoint(int index)
Deprecated.boolean
removeJoint(Joint joint)
Deprecated.boolean
removeListener(Listener listener)
Deprecated.Removes the given listener from this world.void
setAccumulatedTime(double elapsedTime)
Deprecated.Sets the current accumulated time.void
setBounds(Bounds bounds)
Deprecated.Sets the bounds of thisWorld
.void
setBroadphaseDetector(BroadphaseDetector<Body,BodyFixture> broadphaseDetector)
Deprecated.Sets the broad-phase collision detection algorithm.void
setCoefficientMixer(CoefficientMixer coefficientMixer)
Deprecated.Sets theCoefficientMixer
.void
setContactConstraintSolver(ContactConstraintSolver constraintSolver)
Deprecated.Sets theContactConstraintSolver
for this world.void
setContactManager(ContactManager contactManager)
Deprecated.Sets theContactManager
.void
setDetectBroadphaseFilter(BroadphaseFilter<Body,BodyFixture> filter)
Deprecated.Sets theBroadphaseFilter
used when detecting collisions for each time step.void
setGravity(Vector2 gravity)
Deprecated.Sets the acceleration due to gravity.void
setManifoldSolver(ManifoldSolver manifoldSolver)
Deprecated.Sets the manifold solver.void
setNarrowphaseDetector(NarrowphaseDetector narrowphaseDetector)
Deprecated.Sets the narrow-phase collision detection algorithm.void
setRaycastDetector(RaycastDetector raycastDetector)
Deprecated.Sets the raycast detector.void
setSettings(Settings settings)
Deprecated.Sets the dynamics settings for this world.void
setTimeOfImpactDetector(TimeOfImpactDetector timeOfImpactDetector)
Deprecated.Sets the time of impact detector.void
setUpdateRequired(boolean flag)
Deprecated.Sets the update required flag.void
setUserData(Object userData)
Deprecated.Sets the custom user data to the given data.void
shift(Vector2 shift)
Deprecated.Shifts the coordinates of the entire world by the given amount.void
step(int steps)
Deprecated.Performs the given number of simulation steps using the step frequency inSettings
.void
step(int steps, double elapsedTime)
Deprecated.Performs the given number of simulation steps using the given elapsed time for each step.boolean
update(double elapsedTime)
Deprecated.Updates theWorld
.boolean
update(double elapsedTime, double stepElapsedTime)
Deprecated.Updates theWorld
.boolean
update(double elapsedTime, double stepElapsedTime, int maximumSteps)
Deprecated.Updates theWorld
.boolean
update(double elapsedTime, int maximumSteps)
Deprecated.Updates theWorld
.void
updatev(double elapsedTime)
Deprecated.Updates theWorld
.
-
-
-
Constructor Detail
-
World
public World()
Deprecated.Default constructor.Builds a simulation
World
without bounds.Defaults to using
EARTH_GRAVITY
,DynamicAABBTree
broad-phase,Gjk
narrow-phase, andClippingManifoldSolver
.Uses the
Capacity.DEFAULT_CAPACITY
capacity object for initialization.
-
World
public World(Capacity initialCapacity)
Deprecated.Optional constructor.Defaults to using
EARTH_GRAVITY
,DynamicAABBTree
broad-phase,Gjk
narrow-phase, andClippingManifoldSolver
.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(Bounds bounds)
Deprecated.Optional constructor.Defaults to using
EARTH_GRAVITY
,DynamicAABBTree
broad-phase,Gjk
narrow-phase, andClippingManifoldSolver
.- Parameters:
bounds
- the bounds of theWorld
; can be null
-
World
public World(Capacity initialCapacity, Bounds bounds)
Deprecated.Full constructor.Defaults to using
EARTH_GRAVITY
,DynamicAABBTree
broad-phase,Gjk
narrow-phase, andClippingManifoldSolver
.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 settingsbounds
- the bounds of theWorld
; can be null- Throws:
NullPointerException
- if initialCapacity is null- Since:
- 3.1.1
-
-
Method Detail
-
update
public boolean update(double elapsedTime)
Deprecated.Updates theWorld
.This method will only update the world given the step frequency contained in the
Settings
object. You can use theStepListener
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 theWorld
.This method will only update the world given the step frequency contained in the
Settings
object. You can use theStepListener
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 secondsmaximumSteps
- 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 theWorld
.This method will only update the world given the step frequency contained in the
Settings
object. You can use theStepListener
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 theSettings
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 secondsstepElapsedTime
- 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 theWorld
.This method will only update the world given the step frequency contained in the
Settings
object. You can use theStepListener
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 theSettings
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 secondsstepElapsedTime
- the time, in seconds, that the simulation should be advanced for each step; if less than or equal to zeroSettings.getStepFrequency()
will be usedmaximumSteps
- 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 theWorld
.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 inSettings
.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 performelapsedTime
- 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 theBody
s in theWorld
.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
RaycastListener
s before being tested. If anyRaycastListener
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 pointend
- the end pointignoreSensors
- true if sensorBodyFixture
s should be ignoredall
- true if all intersectedBody
s should be returned; false if only the closestBody
should be returnedresults
- a list to contain the results of the raycast- Returns:
- boolean true if at least one
Body
was intersected by theRay
- 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 theBody
s in theWorld
.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
RaycastListener
s before being tested. If anyRaycastListener
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 pointend
- the end pointignoreSensors
- true if sensorBodyFixture
s should be ignoredignoreInactive
- true if inactive bodies should be ignoredall
- true if all intersectedBody
s should be returned; false if only the closestBody
should be returnedresults
- a list to contain the results of the raycast- Returns:
- boolean true if at least one
Body
was intersected by theRay
- 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 theBody
s in theWorld
.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
RaycastListener
s before being tested. If anyRaycastListener
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 pointend
- the end pointfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensorBodyFixture
s should be ignoredignoreInactive
- true if inactive bodies should be ignoredall
- true if all intersectedBody
s should be returned; false if only the closestBody
should be returnedresults
- a list to contain the results of the raycast- Returns:
- boolean true if at least one
Body
was intersected by theRay
- 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 theBody
s in theWorld
.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
RaycastListener
s before being tested. If anyRaycastListener
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
- theRay
maxLength
- the maximum length of the ray; 0 for infinite lengthignoreSensors
- true if sensorBodyFixture
s should be ignoredall
- true if all intersectedBody
s should be returned; false if only the closestBody
should be returnedresults
- a list to contain the results of the raycast- Returns:
- boolean true if at least one
Body
was intersected by the givenRay
- 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 theBody
s in theWorld
.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
RaycastListener
s before being tested. If anyRaycastListener
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
- theRay
maxLength
- the maximum length of the ray; 0 for infinite lengthignoreSensors
- true if sensorBodyFixture
s should be ignoredignoreInactive
- true if inactive bodies should be ignoredall
- true if all intersectedBody
s should be returned; false if only the closestBody
should be returnedresults
- a list to contain the results of the raycast- Returns:
- boolean true if at least one
Body
was intersected by the givenRay
- 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 theBody
s in theWorld
.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
RaycastListener
s before being tested. If anyRaycastListener
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
- theRay
maxLength
- the maximum length of the ray; 0 for infinite lengthfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensorBodyFixture
s should be ignoredignoreInactive
- true if inactive bodies should be ignoredall
- true if all intersectedBody
s should be returned; false if only the closestBody
should be returnedresults
- a list to contain the results of the raycast- Returns:
- boolean true if at least one
Body
was intersected by the givenRay
- 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(Vector2 start, Vector2 end, Body body, boolean ignoreSensors, RaycastResult result)
Deprecated.Performs a raycast against the givenBody
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.All raycasts pass through the
RaycastListener
s before being tested. If anyRaycastListener
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:
start
- the start pointend
- the end pointbody
- theBody
to testignoreSensors
- whether or not to ignore sensorBodyFixture
sresult
- the raycast result- Returns:
- boolean true if the
Ray
intersects theBody
- Throws:
NullPointerException
- if start, end, body, or result is null- Since:
- 2.0.0
- See Also:
raycast(Ray, Body, double, boolean, RaycastResult)
,RaycastListener.allow(Ray, Body, BodyFixture)
-
raycast
public boolean raycast(Vector2 start, Vector2 end, Body body, Filter filter, boolean ignoreSensors, RaycastResult result)
Deprecated.Performs a raycast against the givenBody
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.All raycasts pass through the
RaycastListener
s before being tested. If anyRaycastListener
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:
start
- the start pointend
- the end pointbody
- theBody
to testfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- whether or not to ignore sensorBodyFixture
sresult
- the raycast result- Returns:
- boolean true if the
Ray
intersects theBody
- Throws:
NullPointerException
- if start, end, body, or result is null- Since:
- 3.1.9
- See Also:
raycast(Ray, Body, double, Filter, boolean, RaycastResult)
,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 givenBody
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
RaycastListener
s before being tested. If anyRaycastListener
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
- theRay
to castbody
- theBody
to testmaxLength
- the maximum length of the ray; 0 for infinite lengthignoreSensors
- whether or not to ignore sensorBodyFixture
sresult
- the raycast result- Returns:
- boolean true if the
Ray
intersects theBody
- 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 givenBody
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
RaycastListener
s before being tested. If anyRaycastListener
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
- theRay
to castbody
- theBody
to testmaxLength
- the maximum length of the ray; 0 for infinite lengthfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- whether or not to ignore sensorBodyFixture
sresult
- the raycast result- Returns:
- boolean true if the
Ray
intersects theBody
- 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
ConvexCastListener
s before being tested. If anyConvexCastListener
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 casttransform
- the initial position and orientation of the convexdeltaPosition
- Δposition; the change in position (the cast length and direction basically)ignoreSensors
- true if sensor fixtures should be ignored in the testsall
- true if all hits should be returned; false if only the first should be returnedresults
- 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
ConvexCastListener
s before being tested. If anyConvexCastListener
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 casttransform
- the initial position and orientation of the convexdeltaPosition
- Δposition; the change in position (the cast length and direction basically)ignoreSensors
- true if sensor fixtures should be ignored in the testsignoreInactive
- true if inactive bodies should be ignored in the testsall
- true if all hits should be returned; false if only the first should be returnedresults
- 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. ThedeltaAngle
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
ConvexCastListener
s before being tested. If anyConvexCastListener
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 casttransform
- the initial position and orientation of the convexdeltaPosition
- Δ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 periodignoreSensors
- true if sensor fixtures should be ignored in the testsall
- true if all hits should be returned; false if only the first should be returnedresults
- 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. ThedeltaAngle
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
ConvexCastListener
s before being tested. If anyConvexCastListener
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 casttransform
- the initial position and orientation of the convexdeltaPosition
- Δ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 periodignoreSensors
- true if sensor fixtures should be ignored in the testsignoreInactive
- true if inactive bodies should be ignored in the testsall
- true if all hits should be returned; false if only the first should be returnedresults
- 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. ThedeltaAngle
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
ConvexCastListener
s before being tested. If anyConvexCastListener
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 casttransform
- the initial position and orientation of the convexdeltaPosition
- Δ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 periodfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensor fixtures should be ignored in the testsignoreInactive
- true if inactive bodies should be ignored in the testsall
- true if all hits should be returned; false if only the first should be returnedresults
- 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
ConvexCastListener
s before being tested. If anyConvexCastListener
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 casttransform
- the initial position and orientation of the convexdeltaPosition
- Δposition; the change in position (the cast length and direction basically)body
- the body to cast againstignoreSensors
- true if sensor fixtures should be ignored in the testsresult
- 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. ThedeltaAngle
parameter is the change in angle over the linear cast and is interpolated linearly during detection.All convex casts pass through the
ConvexCastListener
s before being tested. If anyConvexCastListener
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 casttransform
- the initial position and orientation of the convexdeltaPosition
- Δ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 periodbody
- the body to cast againstignoreSensors
- true if sensor fixtures should be ignored in the testsresult
- 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. ThedeltaAngle
parameter is the change in angle over the linear cast and is interpolated linearly during detection.All convex casts pass through the
ConvexCastListener
s before being tested. If anyConvexCastListener
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 casttransform
- the initial position and orientation of the convexdeltaPosition
- Δ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 periodbody
- the body to cast againstfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensor fixtures should be ignored in the testsresult
- 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 aBody
in thisWorld
.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 spaceAABB
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 aBody
Fixture
in thisWorld
.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 spaceAABB
ignoreInactive
- true if inactive bodies should be ignoredresults
- 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 aBody
in thisWorld
.If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.
- Parameters:
aabb
- the world spaceAABB
ignoreSensors
- true if sensor fixtures should be ignoredignoreInactive
- true if inactive bodies should be ignoredresults
- 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 aBody
in thisWorld
.If this method returns true, the results list will contain the bodies and fixtures that the convex overlaps.
- Parameters:
aabb
- the world spaceAABB
filter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensor fixtures should be ignoredignoreInactive
- true if inactive bodies should be ignoredresults
- 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 givenConvex
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 coordinatesresults
- 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 givenConvex
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 coordinatesignoreSensors
- true if sensor fixtures should be ignoredresults
- 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 givenConvex
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 coordinatesignoreSensors
- true if sensor fixtures should be ignoredignoreInactive
- true if inactive bodies should be ignoredresults
- 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 givenConvex
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 coordinatesfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensor fixtures should be ignoredignoreInactive
- true if inactive bodies should be ignoredresults
- 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 givenConvex
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 thePenetration
object filled in theDetectResult
s. Including this information will have a performance impact.- Parameters:
convex
- the convex shape in world coordinatesfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensor fixtures should be ignoredignoreInactive
- true if inactive bodies should be ignoredincludeCollisionData
- true if the overlapPenetration
should be returnedresults
- 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 givenConvex
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 coordinatestransform
- the convex shape's world transformresults
- 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 givenConvex
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 coordinatestransform
- the convex shape's world transformignoreSensors
- true if sensor fixtures should be ignoredresults
- 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 givenConvex
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 coordinatestransform
- the convex shape's world transformignoreSensors
- true if sensor fixtures should be ignoredignoreInactive
- true if inactive bodies should be ignoredresults
- 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 givenConvex
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 coordinatestransform
- the convex shape's world transformfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensor fixtures should be ignoredignoreInactive
- true if inactive bodies should be ignoredresults
- 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 givenConvex
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 thePenetration
object filled in theDetectResult
s. Including this information will have a performance impact.- Parameters:
convex
- the convex shape in local coordinatestransform
- the convex shape's world transformfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensor fixtures should be ignoredignoreInactive
- true if inactive bodies should be ignoredincludeCollisionData
- true if the overlapPenetration
should be returnedresults
- 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 givenAABB
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.
-
detect
public boolean detect(AABB aabb, Body body, Filter filter, boolean ignoreSensors, List<DetectResult> results)
Deprecated.Returns true if the givenAABB
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
- theAABB
in world coordinatesbody
- theBody
to test againstfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensor fixtures should be ignoredresults
- 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 givenConvex
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.
-
detect
public boolean detect(Convex convex, Body body, Filter filter, boolean ignoreSensors, List<DetectResult> results)
Deprecated.Returns true if the givenConvex
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
- theConvex
in world coordinatesbody
- theBody
to test againstfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensor fixtures should be ignoredresults
- 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 givenConvex
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 thePenetration
object filled in theDetectResult
s. Including this information negatively impacts performance.- Parameters:
convex
- theConvex
in world coordinatesbody
- theBody
to test againstfilter
- theFilter
to use against the fixtures; can be nullincludeCollisionData
- true if the overlapPenetration
should be returnedignoreSensors
- true if sensor fixtures should be ignoredresults
- 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 givenConvex
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
- theConvex
in local coordinatestransform
- the convex shape's worldTransform
body
- theBody
to test againstignoreSensors
- true if sensor fixtures should be ignoredresults
- 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 givenConvex
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
- theConvex
in local coordinatestransform
- the convex shape's worldTransform
body
- theBody
to test againstfilter
- theFilter
to use against the fixtures; can be nullignoreSensors
- true if sensor fixtures should be ignoredresults
- 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 givenConvex
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 thePenetration
object filled in theDetectResult
s. Including this information negatively impacts performance.- Parameters:
convex
- theConvex
in local coordinatestransform
- the convex shape's worldTransform
body
- theBody
to test againstfilter
- theFilter
to use against the fixtures; can be nullincludeCollisionData
- true if the overlapPenetration
should be returnedignoreSensors
- true if sensor fixtures should be ignoredresults
- 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)
.
-
addBody
public void addBody(Body body)
Deprecated.- Parameters:
body
- theBody
to add- Throws:
NullPointerException
- if body is nullIllegalArgumentException
- if body has already been added to this world or if its a member of another world instance- Since:
- 3.1.1
-
addJoint
public void addJoint(Joint joint)
Deprecated.- Parameters:
joint
- theJoint
to add- Throws:
NullPointerException
- if joint is nullIllegalArgumentException
- if joint has already been added to this world or if its a member of another world instance- Since:
- 3.1.1
-
containsBody
public boolean containsBody(Body body)
Deprecated.Returns true if this world contains the given body.- Parameters:
body
- theBody
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
- theJoint
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 theBody
at the given index from thisWorld
.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 theBody
at the given index from thisWorld
.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
DestructionListener
s.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 givenBody
from thisWorld
.Use the
removeBody(Body, boolean)
method to enable implicit destruction notification.- Parameters:
body
- theBody
to remove.- Returns:
- boolean true if the body was removed
-
removeBody
public boolean removeBody(Body body, boolean notify)
Deprecated.Removes the givenBody
from thisWorld
.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
DestructionListener
s.This method does not trigger
ContactListener.end(ContactPoint)
events for the contacts that are being removed.- Parameters:
body
- theBody
to removenotify
- 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.
-
removeJoint
public boolean removeJoint(Joint joint)
Deprecated.
-
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 theDestructionListener
- Since:
- 3.1.1
-
removeAllBodies
public void removeAllBodies()
Deprecated.This is a convenience method for theremoveAllBodiesAndJoints()
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 theremoveAllBodiesAndJoints(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 theDestructionListener
- Since:
- 3.0.1
-
removeAllJoints
public void removeAllJoints()
Deprecated.- Since:
- 3.0.1
- See Also:
removeAllJoints(boolean)
-
removeAllJoints
public void removeAllJoints(boolean notify)
Deprecated.- Parameters:
notify
- true if destruction of joints should be notified of by theDestructionListener
- 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 thisWorld
.- 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 Listener> List<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 getlisteners
- 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 nullIllegalArgumentException
- 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
-
getBroadphaseDetector
public BroadphaseDetector<Body,BodyFixture> getBroadphaseDetector()
Deprecated.Returns the broad-phase collision detection algorithm.- Returns:
BroadphaseDetector
the broad-phase collision detection algorithm
-
setDetectBroadphaseFilter
public void setDetectBroadphaseFilter(BroadphaseFilter<Body,BodyFixture> filter)
Deprecated.Sets theBroadphaseFilter
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
-
getDetectBroadphaseFilter
public BroadphaseFilter<Body,BodyFixture> getDetectBroadphaseFilter()
Deprecated.Returns theBroadphaseFilter
used when detecting collisions for each time step.- Returns:
BroadphaseFilter
- 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
-
getCoefficientMixer
public CoefficientMixer getCoefficientMixer()
Deprecated.Returns theCoefficientMixer
.- Returns:
CoefficientMixer
- See Also:
setCoefficientMixer(CoefficientMixer)
-
setCoefficientMixer
public void setCoefficientMixer(CoefficientMixer coefficientMixer)
Deprecated.Sets theCoefficientMixer
.A
CoefficientMixer
is an implementation of mixing functions for various coefficients used in contact solving. Common coefficients are restitution and friction. Since eachBodyFixture
can have it's own value for these coefficients, theCoefficientMixer
is used to mathematically combine them into one coefficient to be used in contact resolution.CoefficientMixer.DEFAULT_MIXER
is the default.- Parameters:
coefficientMixer
- the coefficient mixer- Throws:
NullPointerException
- if coefficientMixer is null- See Also:
CoefficientMixer
-
setContactManager
public void setContactManager(ContactManager contactManager)
Deprecated.Sets theContactManager
.A
ContactManager
manages the contacts detected in thedetect()
method and performs notification ofContactListener
s.ContactManager
s can also contain specialized logic for improving performance and simulation quality.Changing the contact manager requires an update to be performed on the next update of this world and any cached information will be lost.
The default is the
DefaultContactManager
.- Parameters:
contactManager
- the contact manager- Throws:
NullPointerException
- if contactManager is null- Since:
- 3.2.0
- See Also:
ContactManager
-
getContactManager
public ContactManager getContactManager()
Deprecated.Returns theContactManager
.- Returns:
ContactManager
- Since:
- 1.0.2
- See Also:
setContactManager(ContactManager)
-
setContactConstraintSolver
public void setContactConstraintSolver(ContactConstraintSolver constraintSolver)
Deprecated.Sets theContactConstraintSolver
for this world.- Parameters:
constraintSolver
- the contact constraint solver- Throws:
NullPointerException
- if contactManager is null- Since:
- 3.2.0
- See Also:
ContactConstraintSolver
-
getContactConstraintSolver
public ContactConstraintSolver getContactConstraintSolver()
Deprecated.Returns theContactConstraintSolver
.- Returns:
ContactConstraintSolver
- Since:
- 3.2.0
- See Also:
setContactConstraintSolver(ContactConstraintSolver)
-
getUserData
public Object getUserData()
Deprecated.Description copied from interface:DataContainer
Gets the custom user data.- Specified by:
getUserData
in interfaceDataContainer
- 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 interfaceDataContainer
- Parameters:
userData
- the user data
-
getBodyCount
public int getBodyCount()
Deprecated.- Returns:
- int the number of bodies
-
getBody
public Body getBody(int index)
Deprecated.Returns theBody
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:
- int the number of joints
-
getJoint
public Joint getJoint(int index)
Deprecated.Returns theJoint
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 theStep
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)
andupdate(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)
orupdate(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()
-
-