-
- All Implemented Interfaces:
CollisionBody<BodyFixture>
,DataContainer
,PhysicsBody
,Rotatable
,Shiftable
,Transformable
,Translatable
,Ownable
public class Body extends AbstractPhysicsBody implements PhysicsBody, CollisionBody<BodyFixture>, Transformable, DataContainer, Ownable
Full implementation of theCollisionBody
andPhysicsBody
interfaces.- Since:
- 1.0.0
- Version:
- 4.0.0
- Author:
- William Bittle
-
-
Field Summary
-
Fields inherited from interface CollisionBody
TYPICAL_FIXTURE_COUNT
-
Fields inherited from interface PhysicsBody
DEFAULT_ANGULAR_DAMPING, DEFAULT_LINEAR_DAMPING
-
-
Constructor Summary
Constructors Constructor Description Body()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<ContactPoint>
getContacts(boolean sensed)
Deprecated.Deprecated as of 4.0.0.List<Body>
getInContactBodies(boolean sensed)
Deprecated.Deprecated as of 4.0.0.Transform
getInitialTransform()
Deprecated.Deprecated in 4.0.0.List<Body>
getJoinedBodies()
Deprecated.Deprecated as of 4.0.0.List<Joint>
getJoints()
Deprecated.Deprecated as of 4.0.0.boolean
isConnected(Body body)
Deprecated.Deprecated in 4.0.0.boolean
isConnected(Body body, boolean collisionAllowed)
Deprecated.Deprecated in 4.0.0.boolean
isInContact(Body body)
Deprecated.Deprecated in 4.0.0.boolean
isOnIsland()
Deprecated.Deprecated in 4.0.0.void
setOnIsland(boolean flag)
Deprecated.Deprecated in 4.0.0.-
Methods inherited from class AbstractPhysicsBody
addFixture, addFixture, addFixture, applyForce, applyForce, applyForce, applyImpulse, applyImpulse, applyImpulse, applyTorque, applyTorque, clearAccumulatedForce, clearAccumulatedTorque, clearForce, clearTorque, createSweptAABB, createSweptAABB, getAccumulatedForce, getAccumulatedTorque, getAngularDamping, getAngularVelocity, getChangeInOrientation, getChangeInPosition, getForce, getGravityScale, getLinearDamping, getLinearVelocity, getLinearVelocity, getLocalCenter, getMass, getTorque, getWorldCenter, integratePosition, integrateVelocity, isActive, isAsleep, isAtRest, isAtRestDetectionEnabled, isAutoSleepingEnabled, isBullet, isDynamic, isKinematic, isStatic, setActive, setAngularDamping, setAngularVelocity, setAsleep, setAtRest, setAtRestDetectionEnabled, setAutoSleepingEnabled, setBullet, setGravityScale, setLinearDamping, setLinearVelocity, setLinearVelocity, setMass, setMass, setMass, setMassType, toString, updateAtRestTime, updateMass
-
Methods inherited from class AbstractCollisionBody
addFixture, contains, containsFixture, createAABB, createAABB, getFixture, getFixture, getFixtureCount, getFixtureIterator, getFixtureModificationHandler, getFixtures, getFixtures, getLocalPoint, getLocalVector, getOwner, getPreviousTransform, getRotationDiscRadius, getTransform, getUserData, getWorldPoint, getWorldVector, isEnabled, removeAllFixtures, removeFixture, removeFixture, removeFixture, removeFixtures, rotate, rotate, rotate, rotate, rotate, rotate, rotateAboutCenter, setEnabled, setFixtureModificationHandler, setOwner, setTransform, setUserData, shift, translate, translate, translateToOrigin
-
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 PhysicsBody
addFixture, addFixture, applyForce, applyForce, applyForce, applyImpulse, applyImpulse, applyImpulse, applyTorque, applyTorque, clearAccumulatedForce, clearAccumulatedTorque, clearForce, clearTorque, createSweptAABB, createSweptAABB, getAccumulatedForce, getAccumulatedTorque, getAngularDamping, getAngularVelocity, getChangeInOrientation, getChangeInPosition, getForce, getGravityScale, getLinearDamping, getLinearVelocity, getLinearVelocity, getMass, getTorque, integratePosition, integrateVelocity, isActive, isAsleep, isAtRest, isAtRestDetectionEnabled, isAutoSleepingEnabled, isBullet, isDynamic, isKinematic, isStatic, setActive, setAngularDamping, setAngularVelocity, setAsleep, setAtRest, setAtRestDetectionEnabled, setAutoSleepingEnabled, setBullet, setGravityScale, setLinearDamping, setLinearVelocity, setLinearVelocity, setMass, setMass, setMass, setMassType, updateAtRestTime, updateMass
-
Methods inherited from interface Translatable
translate, translate
-
-
-
-
Method Detail
-
isOnIsland
@Deprecated public boolean isOnIsland()
Deprecated.Deprecated in 4.0.0. No longer needed.Returns true if this body is already on an island.- Returns:
- boolean
-
setOnIsland
@Deprecated public void setOnIsland(boolean flag)
Deprecated.Deprecated in 4.0.0. No longer needed.Sets whether this body is on an island.- Parameters:
flag
- true if the body is on an island
-
getInitialTransform
@Deprecated public Transform getInitialTransform()
Deprecated.Deprecated in 4.0.0. Use theAbstractCollisionBody.getPreviousTransform()
method instead.Returns the previous frame's transform.- Returns:
Transform
-
isConnected
@Deprecated public boolean isConnected(Body body)
Deprecated.Deprecated in 4.0.0. Use the isJoined method in PhysicsWorld instead.Returns true if the givenBody
is connected to thisBody
by aJoint
.Returns false if the given body is null.
- Parameters:
body
- the suspect connected body- Returns:
- boolean
-
isConnected
@Deprecated public boolean isConnected(Body body, boolean collisionAllowed)
Deprecated.Deprecated in 4.0.0. Use the isJoined method in PhysicsWorld instead.Returns true if the givenBody
is connected to thisBody
, given the collision flag, via aJoint
.If the given collision flag is true, this method will return true only if collision is allowed between the two joined
Body
s.If the given collision flag is false, this method will return true only if collision is NOT allowed between the two joined
Body
s.If the
Body
s are connected by more than one joint, if any allows collision, then the bodies are considered connected AND allowing collision.Returns false if the given body is null.
- Parameters:
body
- the suspect connected bodycollisionAllowed
- the collision allowed flag- Returns:
- boolean
-
isInContact
@Deprecated public boolean isInContact(Body body)
Deprecated.Deprecated in 4.0.0. Use the isInContact method in PhysicsWorld instead.
-
getJoinedBodies
@Deprecated public List<Body> getJoinedBodies()
Deprecated.Deprecated as of 4.0.0. Use the getJoinedBodies method in PhysicsWorld instead.Returns a list ofBody
s connected byJoint
s.If a body is connected to another body with more than one joint, this method will return just one entry for the connected body.
- Returns:
- List<
Body
> - Since:
- 1.0.1
-
getJoints
@Deprecated public List<Joint> getJoints()
Deprecated.Deprecated as of 4.0.0. Use the getJoints method in PhysicsWorld instead.- Returns:
- List<
Joint
> - Since:
- 1.0.1
-
getInContactBodies
@Deprecated public List<Body> getInContactBodies(boolean sensed)
Deprecated.Deprecated as of 4.0.0. Use the getInContactBodies method in PhysicsWorld instead.Returns a list ofBody
s that are in contact with thisBody
.Passing a value of true results in a list containing only the sensed contacts for this body. Passing a value of false results in a list containing only normal contacts.
Calling this method from any of the
CollisionListener
methods may produce incorrect results.If this body has multiple contact constraints with another body (which can happen when either body has multiple fixtures), this method will only return one entry for the in contact body.
- Parameters:
sensed
- true for only sensed contacts; false for only normal contacts- Returns:
- List<
Body
> - Since:
- 1.0.1
-
getContacts
@Deprecated public List<ContactPoint> getContacts(boolean sensed)
Deprecated.Deprecated as of 4.0.0. Use the getContacts method in PhysicsWorld instead.Returns a list ofContactPoint
sPassing a value of true results in a list containing only the sensed contacts for this body. Passing a value of false results in a list containing only normal contacts.
Calling this method from any of the
CollisionListener
methods may produce incorrect results.Modifying the
ContactPoint
s returned is not advised. Use theContactListener
methods instead.- Parameters:
sensed
- true for only sensed contacts; false for only normal contacts- Returns:
- List<
ContactPoint
> - Since:
- 1.0.1
-
-