Interface PhysicsWorld<T extends PhysicsBody,V extends ContactCollisionData<T>>
-
- Type Parameters:
T
- thePhysicsBody
typeV
- theContactCollisionData
type
- All Superinterfaces:
CollisionWorld<T,BodyFixture,V>
,DataContainer
,Shiftable
- All Known Implementing Classes:
AbstractPhysicsWorld
,World
public interface PhysicsWorld<T extends PhysicsBody,V extends ContactCollisionData<T>> extends CollisionWorld<T,BodyFixture,V>, Shiftable, DataContainer
Represents aCollisionWorld
that resolves collision using Newton's laws of physics. This interface also expands on theCollisionWorld
adding other features like joints, gravity, etc.- Since:
- 4.0.0
- Version:
- 4.0.0
- Author:
- William Bittle
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_INITIAL_JOINT_CAPACITY
The defaultCollisionBody
countstatic Vector2
EARTH_GRAVITY
Earths gravity constantstatic Vector2
ZERO_GRAVITY
Zero gravity constant-
Fields inherited from interface CollisionWorld
DEFAULT_INITIAL_BODY_CAPACITY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addContactListener(ContactListener<T> listener)
Adds the givenContactListener
to this world.boolean
addDestructionListener(DestructionListener<T> listener)
Adds the givenDestructionListener
to this world.void
addJoint(Joint<T> joint)
boolean
addStepListener(StepListener<T> listener)
Adds the givenStepListener
to this world.boolean
addTimeOfImpactListener(TimeOfImpactListener<T> listener)
Adds the givenTimeOfImpactListener
to this world.boolean
containsJoint(Joint<T> joint)
Returns true if this world contains the given joint.double
getAccumulatedTime()
Returns the current accumulated time.CoefficientMixer
getCoefficientMixer()
Returns theCoefficientMixer
.ContactConstraintSolver<T>
getContactConstraintSolver()
Returns theContactConstraintSolver
.List<ContactListener<T>>
getContactListeners()
Returns an unmodifiable list of all the contact listeners registered to this world.List<ContactConstraint<T>>
getContacts(T body)
Returns theContactConstraint
s for the givenPhysicsBody
.List<DestructionListener<T>>
getDestructionListeners()
Returns an unmodifiable list of all the destruction listeners registered to this world.Vector2
getGravity()
Returns the acceleration due to gravity.List<T>
getInContactBodies(T body, boolean includeSensedContact)
Returns a list of allPhysicsBody
s that are in contact with the givenPhysicsBody
.List<T>
getJoinedBodies(T body)
Joint<T>
getJoint(int index)
Returns theJoint
at the given index.int
getJointCount()
Iterator<Joint<T>>
getJointIterator()
Returns an iterator for iterating over the joints in this world.List<Joint<T>>
getJoints()
Returns an unmodifiable list containing all the joints in this world.List<Joint<T>>
getJoints(T body)
Returns theJoint
s the givenPhysicsBody
is a member of.Settings
getSettings()
Returns the settings for this world.List<StepListener<T>>
getStepListeners()
Returns an unmodifiable list of all the step listeners registered to this world.List<TimeOfImpactListener<T>>
getTimeOfImpactListeners()
Returns an unmodifiable list of all the time of impact listeners registered to this world.TimeOfImpactSolver<T>
getTimeOfImpactSolver()
Returns theTimeOfImpactSolver
.TimeStep
getTimeStep()
Returns theTimeStep
object used to advance the simulation.boolean
isInContact(T body1, T body2)
Returns true if the givenPhysicsBody
s are currently in collision.boolean
isJoined(T body1, T body2)
Returns true if the twoPhysicsBody
s are joined via aJoint
.boolean
isJointCollisionAllowed(T body1, T body2)
Returns true if the twoPhysicsBody
s are joined by at least oneJoint
where the collision allowed property is true.boolean
isUpdateRequired()
Returns true if upon the next time step the contacts must be updated.void
removeAllBodies(boolean notify)
This is a convenience method for theremoveAllBodiesAndJoints(boolean)
method since all joints will be removed when all bodies are removed anyway.void
removeAllBodiesAndJoints()
Removes all the joints and bodies from this world.void
removeAllBodiesAndJoints(boolean notify)
Removes all the joints and bodies from this world.void
removeAllContactListeners()
Removes all contact listeners from this world.void
removeAllDestructionListeners()
Removes all destruction listeners from this world.void
removeAllJoints()
void
removeAllJoints(boolean notify)
void
removeAllStepListeners()
Removes all step listeners from this world.void
removeAllTimeOfImpactListeners()
Removes all time of impact listeners from this world.boolean
removeBody(int index, boolean notify)
Removes theCollisionBody
at the given index from thisCollisionWorld
.boolean
removeBody(T body, boolean notify)
Removes the givenCollisionBody
from thisCollisionWorld
.boolean
removeContactListener(ContactListener<T> listener)
Removes the given contact listener from this world and returns true if it was removed.boolean
removeDestructionListener(DestructionListener<T> listener)
Removes the given destruction listener from this world and returns true if it was removed.boolean
removeJoint(int index)
boolean
removeJoint(Joint<T> joint)
boolean
removeStepListener(StepListener<T> listener)
Removes the given step listener from this world and returns true if it was removed.boolean
removeTimeOfImpactListener(TimeOfImpactListener<T> listener)
Removes the given time of impact listener from this world and returns true if it was removed.void
setAccumulatedTime(double elapsedTime)
Sets the current accumulated time.void
setCoefficientMixer(CoefficientMixer coefficientMixer)
Sets theCoefficientMixer
.void
setContactConstraintSolver(ContactConstraintSolver<T> constraintSolver)
Sets theContactConstraintSolver
for this world.void
setGravity(double x, double y)
Sets the acceleration due to gravity.void
setGravity(Vector2 gravity)
Sets the acceleration due to gravity.void
setSettings(Settings settings)
Sets the dynamics settings for this world.void
setTimeOfImpactSolver(TimeOfImpactSolver<T> timeOfImpactSolver)
Sets theTimeOfImpactSolver
for this world.void
setUpdateRequired(boolean flag)
Sets the update required flag.void
step(int steps)
Performs the given number of simulation steps using the step frequency inSettings
.void
step(int steps, double elapsedTime)
Performs the given number of simulation steps using the given elapsed time for each step.boolean
update(double elapsedTime)
Updates thePhysicsWorld
.boolean
update(double elapsedTime, double stepElapsedTime)
Updates theWorld
.boolean
update(double elapsedTime, double stepElapsedTime, int maximumSteps)
Updates theWorld
.boolean
update(double elapsedTime, int maximumSteps)
Updates theWorld
.void
updatev(double elapsedTime)
Updates theWorld
.-
Methods inherited from interface CollisionWorld
addBody, addBoundsListener, addCollisionListener, containsBody, convexCast, convexCastClosest, convexCastClosest, convexCastIterator, detect, detect, detect, detect, detectIterator, detectIterator, detectIterator, detectIterator, getBodies, getBody, getBodyCount, getBodyIterator, getBounds, getBoundsListeners, getBroadphaseDetector, getBroadphaseFilter, getCollisionData, getCollisionDataIterator, getCollisionListeners, getManifoldSolver, getNarrowphaseDetector, getNarrowphasePostProcessor, getRaycastDetector, getTimeOfImpactDetector, isEmpty, raycast, raycast, raycastClosest, raycastClosest, raycastIterator, raycastIterator, removeAllBodies, removeAllBoundsListeners, removeAllCollisionListeners, removeAllListeners, removeBody, removeBody, removeBoundsListener, removeCollisionListener, setBounds, setBroadphaseDetector, setBroadphaseFilter, setManifoldSolver, setNarrowphaseDetector, setNarrowphasePostProcessor, setRaycastDetector, setTimeOfImpactDetector
-
Methods inherited from interface DataContainer
getUserData, setUserData
-
-
-
-
Field Detail
-
DEFAULT_INITIAL_JOINT_CAPACITY
static final int DEFAULT_INITIAL_JOINT_CAPACITY
The defaultCollisionBody
count- See Also:
- Constant Field Values
-
EARTH_GRAVITY
static final Vector2 EARTH_GRAVITY
Earths gravity constant
-
ZERO_GRAVITY
static final Vector2 ZERO_GRAVITY
Zero gravity constant
-
-
Method Detail
-
update
boolean update(double elapsedTime)
Updates thePhysicsWorld
.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
boolean update(double elapsedTime, int maximumSteps)
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
boolean update(double elapsedTime, double stepElapsedTime)
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
boolean update(double elapsedTime, double stepElapsedTime, int maximumSteps)
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
void updatev(double elapsedTime)
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
void step(int steps)
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
void step(int steps, double elapsedTime)
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
-
addJoint
void addJoint(Joint<T> joint)
- 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
-
containsJoint
boolean containsJoint(Joint<T> joint)
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
-
removeJoint
boolean removeJoint(int index)
-
removeAllBodiesAndJoints
void removeAllBodiesAndJoints()
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
void removeAllBodiesAndJoints(boolean notify)
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
-
removeBody
boolean removeBody(int index, boolean notify)
Removes theCollisionBody
at the given index from thisCollisionWorld
.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.- 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
boolean removeBody(T body, boolean notify)
Removes the givenCollisionBody
from thisCollisionWorld
.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.- Parameters:
body
- theCollisionBody
to removenotify
- true if implicit destruction should be notified- Returns:
- boolean true if the body was removed
- Since:
- 3.1.1
-
removeAllBodies
void removeAllBodies(boolean notify)
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
void removeAllJoints()
- Since:
- 3.0.1
- See Also:
removeAllJoints(boolean)
-
removeAllJoints
void removeAllJoints(boolean notify)
- Parameters:
notify
- true if destruction of joints should be notified of by theDestructionListener
- Since:
- 3.0.1
-
getSettings
Settings getSettings()
Returns the settings for this world.- Returns:
Settings
- Since:
- 3.0.3
-
setSettings
void setSettings(Settings settings)
Sets the dynamics settings for this world.- Parameters:
settings
- the desired settings- Since:
- 3.0.3
-
setGravity
void setGravity(Vector2 gravity)
Sets the acceleration due to gravity.- Parameters:
gravity
- the gravity in meters/second2
-
setGravity
void setGravity(double x, double y)
Sets the acceleration due to gravity.- Parameters:
x
- the x component of gravityy
- the y component of gravity- Since:
- 4.0.0
-
getGravity
Vector2 getGravity()
Returns the acceleration due to gravity.- Returns:
Vector2
the gravity in meters/second2
-
getContactListeners
List<ContactListener<T>> getContactListeners()
Returns an unmodifiable list of all the contact listeners registered to this world.- Returns:
- List<
ContactListener
>
-
getDestructionListeners
List<DestructionListener<T>> getDestructionListeners()
Returns an unmodifiable list of all the destruction listeners registered to this world.- Returns:
- List<
DestructionListener
>
-
getStepListeners
List<StepListener<T>> getStepListeners()
Returns an unmodifiable list of all the step listeners registered to this world.- Returns:
- List<
StepListener
>
-
getTimeOfImpactListeners
List<TimeOfImpactListener<T>> getTimeOfImpactListeners()
Returns an unmodifiable list of all the time of impact listeners registered to this world.- Returns:
- List<
TimeOfImpactListener
>
-
removeAllContactListeners
void removeAllContactListeners()
Removes all contact listeners from this world.
-
removeAllDestructionListeners
void removeAllDestructionListeners()
Removes all destruction listeners from this world.
-
removeAllStepListeners
void removeAllStepListeners()
Removes all step listeners from this world.
-
removeAllTimeOfImpactListeners
void removeAllTimeOfImpactListeners()
Removes all time of impact listeners from this world.
-
removeContactListener
boolean removeContactListener(ContactListener<T> listener)
Removes the given contact listener from this world and returns true if it was removed.This method will return false if the listener was not found in this world.
- Parameters:
listener
- the listener- Returns:
- boolean
-
removeDestructionListener
boolean removeDestructionListener(DestructionListener<T> listener)
Removes the given destruction listener from this world and returns true if it was removed.This method will return false if the listener was not found in this world.
- Parameters:
listener
- the listener- Returns:
- boolean
-
removeStepListener
boolean removeStepListener(StepListener<T> listener)
Removes the given step listener from this world and returns true if it was removed.This method will return false if the listener was not found in this world.
- Parameters:
listener
- the listener- Returns:
- boolean
-
removeTimeOfImpactListener
boolean removeTimeOfImpactListener(TimeOfImpactListener<T> listener)
Removes the given time of impact listener from this world and returns true if it was removed.This method will return false if the listener was not found in this world.
- Parameters:
listener
- the listener- Returns:
- boolean
-
addContactListener
boolean addContactListener(ContactListener<T> listener)
Adds the givenContactListener
to this world.NOTE: No effort is made to prevent duplicate listeners from being added.
- Parameters:
listener
- the listener to add- Returns:
- boolean
-
addDestructionListener
boolean addDestructionListener(DestructionListener<T> listener)
Adds the givenDestructionListener
to this world.NOTE: No effort is made to prevent duplicate listeners from being added.
- Parameters:
listener
- the listener to add- Returns:
- boolean
-
addStepListener
boolean addStepListener(StepListener<T> listener)
Adds the givenStepListener
to this world.NOTE: No effort is made to prevent duplicate listeners from being added.
- Parameters:
listener
- the listener to add- Returns:
- boolean
-
addTimeOfImpactListener
boolean addTimeOfImpactListener(TimeOfImpactListener<T> listener)
Adds the givenTimeOfImpactListener
to this world.NOTE: No effort is made to prevent duplicate listeners from being added.
- Parameters:
listener
- the listener to add- Returns:
- boolean
-
getCoefficientMixer
CoefficientMixer getCoefficientMixer()
Returns theCoefficientMixer
.- Returns:
CoefficientMixer
- See Also:
setCoefficientMixer(CoefficientMixer)
-
setCoefficientMixer
void setCoefficientMixer(CoefficientMixer coefficientMixer)
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
-
setContactConstraintSolver
void setContactConstraintSolver(ContactConstraintSolver<T> constraintSolver)
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
ContactConstraintSolver<T> getContactConstraintSolver()
Returns theContactConstraintSolver
.- Returns:
ContactConstraintSolver
- Since:
- 3.2.0
- See Also:
setContactConstraintSolver(ContactConstraintSolver)
-
setTimeOfImpactSolver
void setTimeOfImpactSolver(TimeOfImpactSolver<T> timeOfImpactSolver)
Sets theTimeOfImpactSolver
for this world.- Parameters:
timeOfImpactSolver
- the time of impact solver- Throws:
NullPointerException
- if timeOfImpactSolver is null- Since:
- 4.0.0
-
getTimeOfImpactSolver
TimeOfImpactSolver<T> getTimeOfImpactSolver()
Returns theTimeOfImpactSolver
.- Returns:
TimeOfImpactSolver
- Since:
- 4.0.0
-
getJointCount
int getJointCount()
- Returns:
- int the number of joints
-
getJoint
Joint<T> getJoint(int index)
Returns theJoint
at the given index.- Parameters:
index
- the index- Returns:
Joint
-
getJoints
List<Joint<T>> getJoints()
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
Iterator<Joint<T>> getJointIterator()
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
-
getTimeStep
TimeStep getTimeStep()
Returns theTimeStep
object used to advance the simulation.The returned object contains the step information (elapsed time) for the last and the previous time step.
- Returns:
TimeStep
the current step object- Since:
- 4.0.0
-
getAccumulatedTime
double getAccumulatedTime()
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
void setAccumulatedTime(double elapsedTime)
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()
-
isUpdateRequired
boolean isUpdateRequired()
Returns true if upon the next time step the contacts must be updated.- Returns:
- boolean
- See Also:
setUpdateRequired(boolean)
-
setUpdateRequired
void setUpdateRequired(boolean flag)
Sets the update required flag.This flag indicates that changes have been made to the bodies, fixtures, joints, etc. of this
PhysicsWorld
that require another collision detection cycle. The following conditions outline the common reasons a user would set this flag to true:- 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
-
isInContact
boolean isInContact(T body1, T body2)
Returns true if the givenPhysicsBody
s are currently in collision.Collision is defined as the two bodies interacting to the level of
ContactConstraint
generation and solving.- Parameters:
body1
- the first bodybody2
- the second body- Returns:
- boolean
-
getInContactBodies
List<T> getInContactBodies(T body, boolean includeSensedContact)
Returns a list of allPhysicsBody
s that are in contact with the givenPhysicsBody
.- Parameters:
body
- the bodyincludeSensedContact
- true if sensed contacts should be included in the results- Returns:
- List<
PhysicsBody
>
-
getContacts
List<ContactConstraint<T>> getContacts(T body)
Returns theContactConstraint
s for the givenPhysicsBody
.These represent the contact pairs between the given body and the others it's colliding with. Each
ContactConstraint
could have 1 or 2 contacts associated with it.- Parameters:
body
- the body- Returns:
- List<
ContactConstraint
>
-
isJoined
boolean isJoined(T body1, T body2)
Returns true if the twoPhysicsBody
s are joined via aJoint
.- Parameters:
body1
- the first bodybody2
- the second body- Returns:
- boolean
-
isJointCollisionAllowed
boolean isJointCollisionAllowed(T body1, T body2)
Returns true if the twoPhysicsBody
s are joined by at least oneJoint
where the collision allowed property is true.- Parameters:
body1
- the first bodybody2
- the second body- Returns:
- boolean
-
getJoinedBodies
List<T> getJoinedBodies(T body)
- Parameters:
body
- the body- Returns:
- List<
PhysicsBody
>
-
-