
 All Superinterfaces:
CollisionBody<BodyFixture>
,DataContainer
,Ownable
,Rotatable
,Shiftable
,Transformable
,Translatable
 All Known Implementing Classes:
AbstractPhysicsBody
,Body
public interface PhysicsBody extends CollisionBody<BodyFixture>, Transformable, Shiftable, DataContainer, Ownable
Represents a physicalPhysicsBody
.A
PhysicsBody
typically has at least oneBodyFixture
attached to it. theBodyFixture
s represent the shape of the body. When a body is first created the body is a shapeless infinite mass body. Add fixtures to the body using theaddFixture
methods.Use the
setMass(org.dyn4j.geometry.MassType)
methods to calculate the mass of the entirePhysicsBody
given the currently attachedBodyFixture
s. ThesetMass(Mass)
method can be used to set the mass directly. Use thesetMassType(org.dyn4j.geometry.MassType)
method to toggle the mass type between the special types.The coefficient of friction and restitution and the linear and angular damping are all defaulted but can be changed via the accessor and mutator methods.
By default
PhysicsBody
s are flagged as atrest automatically. This occurs when their linear or angular velocity is low enough (as determined by theSettings.getMaximumAtRestLinearVelocity()
andSettings.getMaximumAtRestAngularVelocity()
methods) and they have been this way for a period of time (as determined bySettings.getMinimumAtRestTime()
). Applying any force, torque, or impulse will wake thePhysicsBody
.A
PhysicsBody
becomes disabled when thePhysicsBody
has left the boundary of the world.A
PhysicsBody
is dynamic if either its inertia or mass is greater than zero. APhysicsBody
is static if both its inertia and mass are close to zero.A
PhysicsBody
flagged as a bulletsetBullet(boolean)
will be checked for tunneling depending on the CCD setting in the world'sSettings
. Use this if the body is a fast moving body, but be careful as this will incur a performance hit. Since:
 1.0.0
 Version:
 4.0.0
 Author:
 William Bittle


Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_ANGULAR_DAMPING
The default angular damping; value =DEFAULT_ANGULAR_DAMPING
static double
DEFAULT_LINEAR_DAMPING
The default linear damping; value =DEFAULT_LINEAR_DAMPING

Fields inherited from interface CollisionBody
TYPICAL_FIXTURE_COUNT


Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description BodyFixture
addFixture(Convex convex, double density)
Creates aBodyFixture
for the givenConvex
Shape
, adds it to thePhysicsBody
, and returns it for configuration.BodyFixture
addFixture(Convex convex, double density, double friction, double restitution)
Creates aBodyFixture
for the givenConvex
Shape
, adds it to thePhysicsBody
, and returns it for configuration.PhysicsBody
applyForce(Force force)
Applies the givenForce
to thisPhysicsBody
.PhysicsBody
applyForce(Vector2 force)
Applies the given force to thisPhysicsBody
.PhysicsBody
applyForce(Vector2 force, Vector2 point)
Applies the given force to thisPhysicsBody
at the given point (torque).PhysicsBody
applyImpulse(double impulse)
Applies an angular impulse to thisPhysicsBody
about its center of mass.PhysicsBody
applyImpulse(Vector2 impulse)
Applies a linear impulse to thisPhysicsBody
at its center of mass.PhysicsBody
applyImpulse(Vector2 impulse, Vector2 point)
Applies an impulse to thisPhysicsBody
at the given point.PhysicsBody
applyTorque(double torque)
Applies the given torque about the center of thisPhysicsBody
.PhysicsBody
applyTorque(Torque torque)
Applies the givenTorque
to thisPhysicsBody
.void
clearAccumulatedForce()
Clears the forces stored in the force accumulator.void
clearAccumulatedTorque()
Clears the torques stored in the torque accumulator.void
clearForce()
Clears the last time step's force on thePhysicsBody
.void
clearTorque()
Clears the last time step's torque on thePhysicsBody
.AABB
createSweptAABB()
Returns an AABB that contains the maximal space in which theCollisionBody
exists from the initial transform to the final transform.AABB
createSweptAABB(Transform initialTransform, Transform finalTransform)
Creates a sweptAABB
from the given start and endTransform
s using the fixtures on thisPhysicsBody
.Vector2
getAccumulatedForce()
Returns the total force currently stored in the force accumulator.double
getAccumulatedTorque()
Returns the total torque currently stored in the torque accumulator.double
getAngularDamping()
Returns the angular damping.double
getAngularVelocity()
Returns the angular velocity.double
getChangeInOrientation()
Returns the change in orientation computed from last frame's transform and this frame's transform.Vector2
getChangeInPosition()
Returns the change in position computed from last frame's transform and this frame's transform.Vector2
getForce()
Returns the force applied in the last iteration.double
getGravityScale()
Returns the gravity scale.double
getLinearDamping()
Returns the linear damping.Vector2
getLinearVelocity()
Returns the linear velocity.Vector2
getLinearVelocity(Vector2 point)
Returns the velocity of this body at the given world space point.Mass
getMass()
Returns thisPhysicsBody
's mass information.double
getTorque()
Returns the torque applied in the last iteration.void
integratePosition(TimeStep timestep, Settings settings)
Integrates the linear and angular velocities to update the position and rotation of this bodyvoid
integrateVelocity(Vector2 gravity, TimeStep timestep, Settings settings)
Integrates the forces, torques, and gravity to update the linear and angular velocity of this body.boolean
isActive()
Deprecated.Deprecated in 4.0.0.boolean
isAsleep()
Deprecated.Deprecated in 4.0.0.boolean
isAtRest()
Returns true if thisPhysicsBody
is atrest.boolean
isAtRestDetectionEnabled()
Returns true if thisPhysicsBody
can participate in automatic atrest detection.boolean
isAutoSleepingEnabled()
Deprecated.Deprecated in 4.0.0.boolean
isBullet()
Returns true if thisPhysicsBody
is a bullet.boolean
isDynamic()
Returns true if this body's mass type is NOTMassType.INFINITE
.boolean
isKinematic()
Returns true if this body's mass type isMassType.INFINITE
and either the linear or angular velocity are NOT zero (i.e.boolean
isStatic()
Returns true if this body's mass type isMassType.INFINITE
and the linear and angular velocity are close to zero (as determined byEpsilon.E
.void
setActive(boolean flag)
Deprecated.Deprecated in 4.0.0.void
setAngularDamping(double angularDamping)
Sets the angular damping.void
setAngularVelocity(double angularVelocity)
Sets the angular velocity in radians per secondvoid
setAsleep(boolean flag)
Deprecated.Deprecated in 4.0.0.void
setAtRest(boolean flag)
Sets whether thisPhysicsBody
is atrest or not.void
setAtRestDetectionEnabled(boolean flag)
Determines whether thisPhysicsBody
can participate in automatic atrest detection.void
setAutoSleepingEnabled(boolean flag)
Deprecated.Deprecated in 4.0.0.void
setBullet(boolean flag)
Sets the bullet flag for thisPhysicsBody
.void
setGravityScale(double scale)
Sets the gravity scale.void
setLinearDamping(double linearDamping)
Sets the linear damping.void
setLinearVelocity(double x, double y)
Sets the linear velocity.void
setLinearVelocity(Vector2 velocity)
Sets the linear velocity.PhysicsBody
setMass()
Deprecated.removed in 3.2.0 usesetMass(MassType)
insteadPhysicsBody
setMass(Mass mass)
Explicitly sets thisPhysicsBody
's mass information.PhysicsBody
setMass(MassType type)
This method should be called after fixture modification is complete.PhysicsBody
setMassType(MassType type)
Sets theMassType
of thisPhysicsBody
.double
updateAtRestTime(TimeStep timestep, Settings settings)
Updates the atrest time for this body based on the given timestep and returns the current atrest time.PhysicsBody
updateMass()
This is a shortcut method for thesetMass(org.dyn4j.geometry.MassType)
method that will use the current mass type as the mass type and then recompute the mass from the body's fixtures.
Methods inherited from interface CollisionBody
addFixture, addFixture, contains, containsFixture, createAABB, createAABB, getFixture, getFixture, getFixtureCount, getFixtureIterator, getFixtureModificationHandler, getFixtures, getFixtures, getLocalCenter, getLocalPoint, getLocalVector, getPreviousTransform, getRotationDiscRadius, getTransform, getWorldCenter, getWorldPoint, getWorldVector, isEnabled, removeAllFixtures, removeFixture, removeFixture, removeFixture, removeFixtures, rotateAboutCenter, setEnabled, setFixtureModificationHandler, setTransform, translateToOrigin

Methods inherited from interface DataContainer
getUserData, setUserData

Methods inherited from interface Translatable
translate, translate




Field Detail

DEFAULT_LINEAR_DAMPING
static final double DEFAULT_LINEAR_DAMPING
The default linear damping; value =DEFAULT_LINEAR_DAMPING
 See Also:
 Constant Field Values

DEFAULT_ANGULAR_DAMPING
static final double DEFAULT_ANGULAR_DAMPING
The default angular damping; value =DEFAULT_ANGULAR_DAMPING
 See Also:
 Constant Field Values


Method Detail

addFixture
BodyFixture addFixture(Convex convex, double density)
Creates aBodyFixture
for the givenConvex
Shape
, adds it to thePhysicsBody
, and returns it for configuration.After adding or removing fixtures make sure to call the
updateMass()
orsetMass(MassType)
method to compute the new totalMass
for the body.This is a convenience method for setting the density of a
BodyFixture
. Parameters:
convex
 theConvex
Shape
to add to thePhysicsBody
density
 the density of the shape in kg/m^{2}; in the range (0.0, ∞] Returns:
BodyFixture
the fixture created using the givenShape
and added to thePhysicsBody
 Throws:
NullPointerException
 if convex is nullIllegalArgumentException
 if density is less than or equal to zero; if friction or restitution is less than zero Since:
 3.1.5
 See Also:
CollisionBody.addFixture(Convex)
,addFixture(Convex, double, double, double)

addFixture
BodyFixture addFixture(Convex convex, double density, double friction, double restitution)
Creates aBodyFixture
for the givenConvex
Shape
, adds it to thePhysicsBody
, and returns it for configuration.After adding or removing fixtures make sure to call the
updateMass()
orsetMass(MassType)
method to compute the new totalMass
for the body.This is a convenience method for setting the properties of a
BodyFixture
. Use theBodyFixture.DEFAULT_DENSITY
,BodyFixture.DEFAULT_FRICTION
, andBodyFixture.DEFAULT_RESTITUTION
values if you need to only set one of these properties. Parameters:
convex
 theConvex
Shape
to add to thePhysicsBody
density
 the density of the shape in kg/m^{2}; in the range (0.0, ∞]friction
 the coefficient of friction; in the range [0.0, ∞]restitution
 the coefficient of restitution; in the range [0.0, ∞] Returns:
BodyFixture
the fixture created using the givenShape
and added to thePhysicsBody
 Throws:
NullPointerException
 if convex is nullIllegalArgumentException
 if density is less than or equal to zero; if friction or restitution is less than zero Since:
 3.1.1
 See Also:
CollisionBody.addFixture(Convex)
,addFixture(Convex, double)

setMass
@Deprecated PhysicsBody setMass()
Deprecated.removed in 3.2.0 usesetMass(MassType)
insteadThis method should be called after fixture modification is complete.This method will calculate a total mass for the body given the masses of the fixtures.
This method will always set this body's mass type to Normal.
 Returns:
PhysicsBody
this body

updateMass
PhysicsBody updateMass()
This is a shortcut method for thesetMass(org.dyn4j.geometry.MassType)
method that will use the current mass type as the mass type and then recompute the mass from the body's fixtures. Returns:
PhysicsBody
this body Since:
 3.2.0
 See Also:
setMass(org.dyn4j.geometry.MassType)

setMass
PhysicsBody setMass(MassType type)
This method should be called after fixture modification is complete.This method will calculate a total mass for the body given the masses of the attached fixtures.
A
MassType
can be used to create special mass types. Parameters:
type
 the mass type Returns:
PhysicsBody
this body

setMass
PhysicsBody setMass(Mass mass)
Explicitly sets thisPhysicsBody
's mass information. Parameters:
mass
 the newMass
 Returns:
PhysicsBody
this body Throws:
NullPointerException
 if the given mass is null

setMassType
PhysicsBody setMassType(MassType type)
Sets theMassType
of thisPhysicsBody
.This method does not compute/recompute the mass of the body but solely sets the mass type to one of the special types.
Since its possible to create a
Mass
object with zero mass and/or zero inertia (Mass m = new Mass(new Vector2(), 0, 0);
for example), setting the type to something other than MassType.INFINITE can have undefined results. Parameters:
type
 the desired type Returns:
PhysicsBody
this body Throws:
NullPointerException
 if the given mass type is null Since:
 2.2.3

getMass
Mass getMass()
Returns thisPhysicsBody
's mass information. Returns:
Mass

applyForce
PhysicsBody applyForce(Vector2 force)
Applies the given force to thisPhysicsBody
.This method will wakeup the body if its sleeping.
This method does not apply the force if this body returns zero from the
Mass.getMass()
method.The force is not applied immediately, but instead stored in the force accumulator (
getAccumulatedForce()
). This is to preserve the last time step's computed force (getForce()
.The force is assumed to be in world space coordinates.
 Parameters:
force
 the force Returns:
PhysicsBody
this body Throws:
NullPointerException
 if force is null Since:
 3.1.1

applyForce
PhysicsBody applyForce(Force force)
Applies the givenForce
to thisPhysicsBody
.This method will wakeup the body if its sleeping.
This method does not apply the force if this body returns zero from the
Mass.getMass()
method.The force is not applied immediately, but instead stored in the force accumulator (
getAccumulatedForce()
). This is to preserve the last time step's computed force (getForce()
.The force is assumed to be in world space coordinates.
 Parameters:
force
 the force Returns:
PhysicsBody
this body Throws:
NullPointerException
 if force is null Since:
 3.1.1

applyTorque
PhysicsBody applyTorque(double torque)
Applies the given torque about the center of thisPhysicsBody
.This method will wakeup the body if its sleeping.
This method does not apply the torque if this body returns zero from the
Mass.getInertia()
method.The torque is not applied immediately, but instead stored in the torque accumulator (
getAccumulatedTorque()
). This is to preserve the last time step's computed torque (getTorque()
. Parameters:
torque
 the torque about the center Returns:
PhysicsBody
this body Since:
 3.1.1

applyTorque
PhysicsBody applyTorque(Torque torque)
Applies the givenTorque
to thisPhysicsBody
.This method will wakeup the body if its sleeping.
This method does not apply the torque if this body returns zero from the
Mass.getInertia()
method.The torque is not applied immediately, but instead stored in the torque accumulator (
getAccumulatedTorque()
). This is to preserve the last time step's computed torque (getTorque()
. Parameters:
torque
 the torque Returns:
PhysicsBody
this body Throws:
NullPointerException
 if torque is null Since:
 3.1.1

applyForce
PhysicsBody applyForce(Vector2 force, Vector2 point)
Applies the given force to thisPhysicsBody
at the given point (torque).This method will wakeup the body if its sleeping.
This method does not apply the force if this body returns zero from the
Mass.getMass()
method nor will it apply the torque if this body returns zero from theMass.getInertia()
method.The force/torque is not applied immediately, but instead stored in the force/torque accumulators (
getAccumulatedForce()
andgetAccumulatedTorque()
). This is to preserve the last time step's computed force (getForce()
and torque (getTorque()
).The force and point are assumed to be in world space coordinates.
 Parameters:
force
 the forcepoint
 the application point in world coordinates Returns:
PhysicsBody
this body Throws:
NullPointerException
 if force or point is null Since:
 3.1.1

applyImpulse
PhysicsBody applyImpulse(Vector2 impulse)
Applies a linear impulse to thisPhysicsBody
at its center of mass.This method will wakeup the body if its sleeping.
This method does not apply the impulse if this body's mass returns zero from the
Mass.getInertia()
method.NOTE: Applying an impulse differs from applying a force and/or torque. Forces and torques are stored in accumulators, but impulses are applied to the velocities of the body immediately.
The impulse is assumed to be in world space coordinates.
 Parameters:
impulse
 the impulse to apply Returns:
PhysicsBody
this body Throws:
NullPointerException
 if impulse is null Since:
 3.1.1

applyImpulse
PhysicsBody applyImpulse(double impulse)
Applies an angular impulse to thisPhysicsBody
about its center of mass.This method will wakeup the body if its sleeping.
This method does not apply the impulse if this body's inertia returns zero from the
Mass.getInertia()
method.NOTE: Applying an impulse differs from applying a force and/or torque. Forces and torques are stored in accumulators, but impulses are applied to the velocities of the body immediately.
 Parameters:
impulse
 the impulse to apply Returns:
PhysicsBody
this body Since:
 3.1.1

applyImpulse
PhysicsBody applyImpulse(Vector2 impulse, Vector2 point)
Applies an impulse to thisPhysicsBody
at the given point.This method will wakeup the body if its sleeping.
This method does not apply the linear impulse if this body returns zero from the
Mass.getMass()
method nor will it apply the angular impulse if this body returns zero from theMass.getInertia()
method.NOTE: Applying an impulse differs from applying a force and/or torque. Forces and torques are stored in accumulators, but impulses are applied to the velocities of the body immediately.
The impulse and point are assumed to be in world space coordinates.
 Parameters:
impulse
 the impulse to applypoint
 the world space point to apply the impulse Returns:
PhysicsBody
this body Throws:
NullPointerException
 if impulse or point is null Since:
 3.1.1

clearForce
void clearForce()
Clears the last time step's force on thePhysicsBody
.

clearAccumulatedForce
void clearAccumulatedForce()
Clears the forces stored in the force accumulator.Renamed from clearForces (3.0.0 and below).
 Since:
 3.0.1

clearTorque
void clearTorque()
Clears the last time step's torque on thePhysicsBody
.

clearAccumulatedTorque
void clearAccumulatedTorque()
Clears the torques stored in the torque accumulator.Renamed from clearTorques (3.0.0 and below).
 Since:
 3.0.1

integrateVelocity
void integrateVelocity(Vector2 gravity, TimeStep timestep, Settings settings)
Integrates the forces, torques, and gravity to update the linear and angular velocity of this body. Parameters:
gravity
 the world gravitytimestep
 the timestep informationsettings
 the world settings

integratePosition
void integratePosition(TimeStep timestep, Settings settings)
Integrates the linear and angular velocities to update the position and rotation of this body Parameters:
timestep
 the timestep informationsettings
 the world settings

updateAtRestTime
double updateAtRestTime(TimeStep timestep, Settings settings)
Updates the atrest time for this body based on the given timestep and returns the current atrest time.For
isStatic()
bodies, this method will return 1 to indicate that this body can always be atrest since it's velocity is zero and cannot be moved. Parameters:
timestep
 the timestep informationsettings
 the world settings Returns:
 double

isStatic
boolean isStatic()
Returns true if this body's mass type isMassType.INFINITE
and the linear and angular velocity are close to zero (as determined byEpsilon.E
. Returns:
 boolean

isKinematic
boolean isKinematic()
Returns true if this body's mass type isMassType.INFINITE
and either the linear or angular velocity are NOT zero (i.e. it's moving). Returns:
 boolean

isDynamic
boolean isDynamic()
Returns true if this body's mass type is NOTMassType.INFINITE
. Returns:
 boolean

setActive
@Deprecated void setActive(boolean flag)
Deprecated.Deprecated in 4.0.0. UseCollisionBody.setEnabled(boolean)
instead.Sets whether thisPhysicsBody
is active or not. Parameters:
flag
 true if thisPhysicsBody
should be active

isActive
@Deprecated boolean isActive()
Deprecated.Deprecated in 4.0.0. UseCollisionBody.isEnabled()
instead.Returns true if thisPhysicsBody
is active. Returns:
 boolean

setAutoSleepingEnabled
@Deprecated void setAutoSleepingEnabled(boolean flag)
Deprecated.Deprecated in 4.0.0. UsesetAtRestDetectionEnabled(boolean)
instead.Sets thePhysicsBody
to allow or disallow automatic sleeping. Parameters:
flag
 true if thePhysicsBody
is allowed to sleep Since:
 1.2.0

isAutoSleepingEnabled
@Deprecated boolean isAutoSleepingEnabled()
Deprecated.Deprecated in 4.0.0. UseisAtRestDetectionEnabled()
instead.Returns true if thisPhysicsBody
is allowed to be put to sleep automatically. Returns:
 boolean
 Since:
 1.2.0

setAtRestDetectionEnabled
void setAtRestDetectionEnabled(boolean flag)
Determines whether thisPhysicsBody
can participate in automatic atrest detection. Parameters:
flag
 true if it should Since:
 4.0.0

isAtRestDetectionEnabled
boolean isAtRestDetectionEnabled()
Returns true if thisPhysicsBody
can participate in automatic atrest detection. Returns:
 boolean
 Since:
 4.0.0

setAsleep
@Deprecated void setAsleep(boolean flag)
Deprecated.Deprecated in 4.0.0. UsesetAtRest(boolean)
instead.Sets whether thisPhysicsBody
is awake or not.If flag is true, this body's velocity, angular velocity, force, torque, and accumulators are cleared.
 Parameters:
flag
 true if the body should be put to sleep

isAsleep
@Deprecated boolean isAsleep()
Deprecated.Deprecated in 4.0.0. UseisAtRest()
instead.Returns true if thisPhysicsBody
is sleeping. Returns:
 boolean

setAtRest
void setAtRest(boolean flag)
Sets whether thisPhysicsBody
is atrest or not.If flag is true, this body's velocity, angular velocity, force, torque, and accumulators are cleared.
 Parameters:
flag
 true if the body should be atrest Since:
 4.0.0

isAtRest
boolean isAtRest()
Returns true if thisPhysicsBody
is atrest. Returns:
 boolean
 Since:
 4.0.0

setBullet
void setBullet(boolean flag)
Sets the bullet flag for thisPhysicsBody
.A bullet is a very fast moving body that requires continuous collision detection with all other
PhysicsBody
s to ensure that no collisions are missed. Parameters:
flag
 true if thisPhysicsBody
is a bullet Since:
 1.2.0

isBullet
boolean isBullet()
Returns true if thisPhysicsBody
is a bullet. Returns:
 boolean
 Since:
 1.2.0
 See Also:
setBullet(boolean)

createSweptAABB
AABB createSweptAABB()
Returns an AABB that contains the maximal space in which theCollisionBody
exists from the initial transform to the final transform.This method takes the bounding circle, using the world center and rotation disc radius, at the initial and final transforms and creates an AABB containing both.
This method will return a degenerate AABB if the body has zero fixtures. If this body has one or more fixtures, but didn't move, an AABB with a width and height equal to the rotation disc radius is returned.
NOTE: To get an accurate result from this method, one of the
setMass
methods should be called to set the rotation disc radius before calling this method. Returns:
AABB
 Since:
 3.1.1

createSweptAABB
AABB createSweptAABB(Transform initialTransform, Transform finalTransform)
Creates a sweptAABB
from the given start and endTransform
s using the fixtures on thisPhysicsBody
.This method takes the bounding circle, using the world center and rotation disc radius, at the initial and final transforms and creates an AABB containing both.
This method will return a degenerate AABB if the body has zero fixtures. If this body has one or more fixtures, but didn't move, an AABB with a width and height equal to the rotation disc radius is returned.
NOTE: To get an accurate result from this method, one of the
setMass
methods should be called to set the rotation disc radius before calling this method.

getChangeInPosition
Vector2 getChangeInPosition()
Returns the change in position computed from last frame's transform and this frame's transform. Returns:
 Vector2
 Since:
 3.1.5

getChangeInOrientation
double getChangeInOrientation()
Returns the change in orientation computed from last frame's transform and this frame's transform.This method will return a change in the range [0, 2π). This isn't as useful if the angular velocity is greater than 2π per time step. Since we don't have the timestep here, we can't compute the exact change in this case.
If the angular velocity is zero, this method returns the minimum difference in orientation.
 Returns:
 double
 Since:
 3.1.5

getLinearVelocity
Vector2 getLinearVelocity()
Returns the linear velocity. Returns:
Vector2
 Since:
 3.1.5

getLinearVelocity
Vector2 getLinearVelocity(Vector2 point)
Returns the velocity of this body at the given world space point. Parameters:
point
 the point in world space Returns:
Vector2
 Since:
 3.1.5

setLinearVelocity
void setLinearVelocity(Vector2 velocity)
Sets the linear velocity.Call the
setAsleep(boolean)
method to wake up thePhysicsBody
if thePhysicsBody
is asleep and the velocity is not zero. Parameters:
velocity
 the desired velocity Throws:
NullPointerException
 if velocity is null Since:
 3.1.5

setLinearVelocity
void setLinearVelocity(double x, double y)
Sets the linear velocity.Call the
setAsleep(boolean)
method to wake up thePhysicsBody
if thePhysicsBody
is asleep and the velocity is not zero. Parameters:
x
 the linear velocity along the xaxisy
 the linear velocity along the yaxis Since:
 3.1.5

getAngularVelocity
double getAngularVelocity()
Returns the angular velocity. Returns:
 double

setAngularVelocity
void setAngularVelocity(double angularVelocity)
Sets the angular velocity in radians per secondCall the
setAsleep(boolean)
method to wake up thePhysicsBody
if thePhysicsBody
is asleep and the velocity is not zero. Parameters:
angularVelocity
 the angular velocity in radians per second

getForce
Vector2 getForce()
Returns the force applied in the last iteration.This is the accumulated force from the last iteration.
 Returns:
Vector2

getAccumulatedForce
Vector2 getAccumulatedForce()
Returns the total force currently stored in the force accumulator. Returns:
Vector2
 Since:
 3.0.1

getTorque
double getTorque()
Returns the torque applied in the last iteration.This is the accumulated torque from the last iteration.
 Returns:
 double

getAccumulatedTorque
double getAccumulatedTorque()
Returns the total torque currently stored in the torque accumulator. Returns:
 double
 Since:
 3.0.1

getLinearDamping
double getLinearDamping()
Returns the linear damping. Returns:
 double
 See Also:
setLinearDamping(double)

setLinearDamping
void setLinearDamping(double linearDamping)
Sets the linear damping.Linear damping is used to reduce the linear velocity over time. The default is zero and larger values will cause the linear velocity to reduce faster.
The units are seconds^{1}.
 Parameters:
linearDamping
 the linear damping; must be greater than or equal to zero Throws:
IllegalArgumentException
 if linearDamping is less than zero

getAngularDamping
double getAngularDamping()
Returns the angular damping. Returns:
 double
 See Also:
setAngularDamping(double)

setAngularDamping
void setAngularDamping(double angularDamping)
Sets the angular damping.Angular damping is used to reduce the angular velocity over time. The default is zero and larger values will cause the angular velocity to reduce faster.
The units are seconds^{1}.
 Parameters:
angularDamping
 the angular damping; must be greater than or equal to zero Throws:
IllegalArgumentException
 if angularDamping is less than zero

getGravityScale
double getGravityScale()
Returns the gravity scale. Returns:
 double
 Since:
 3.0.0
 See Also:
setGravityScale(double)

setGravityScale
void setGravityScale(double scale)
Sets the gravity scale.The gravity scale is a multiplier applied to the acceleration due to gravity before applying the force of gravity to the body. This allows bodies to be affected differently under the same gravity.
 Parameters:
scale
 the gravity scale for this body Since:
 3.0.0

