| Modifier and Type | Field and Description |
|---|---|
| protected long | addr
the address of the body |
| private Array | fixtures
Fixtures of this body |
| protected Array | joints
Joints of this body |
| private final Vector2 | |
| public final Vector2 | |
| public final Vector2 | |
| private final Vector2 | |
| private final Vector2 | |
| public final Vector2 | |
| public final Vector2 | |
| private final MassData | |
| private final Vector2 | |
| private final float[] | tmp
temporary float array |
| private final ByteBuffer | tmpBuff
temporary ByteBuffer |
| private final long | |
| private final Transform | |
| private Object | userData
user data |
| private final World | world
World |
| private final Vector2 | |
| private final Vector2 |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public void | applyAngularImpulse(float
the angular impulse in units of kg*m*m/s impulse, boolean wake)Apply an angular impulse. |
| public void | applyForce(Vector2
the world force vector, usually in Newtons (N). force, Vector2 the world position of the point of application. point, boolean up the body wake)Apply a force at a world point. |
| public void | applyForce(float
the world force vector on x, usually in Newtons (N). forceX, float the world force vector on y, usually in Newtons (N). forceY, float the world position of the point of application on x. pointX, float the world position of the point of application on y. pointY, boolean up the body wake)Apply a force at a world point. |
| public void | applyForceToCenter(Vector2
the world force vector, usually in Newtons (N). force, boolean wake)Apply a force to the center of mass. |
| public void | applyForceToCenter(float
the world force vector, usually in Newtons (N). forceX, float the world force vector, usually in Newtons (N). forceY, boolean wake)Apply a force to the center of mass. |
| public void | applyLinearImpulse(Vector2
the world impulse vector, usually in N-seconds or kg-m/s. impulse, Vector2 the world position of the point of application. point, boolean up the body wake)Apply an impulse at a point. |
| public void | applyLinearImpulse(float
the world impulse vector on the x-axis, usually in N-seconds or kg-m/s. impulseX, float the world impulse vector on the y-axis, usually in N-seconds or kg-m/s. impulseY, float the world position of the point of application on the x-axis. pointX, float the world position of the point of application on the y-axis. pointY, boolean up the body wake)Apply an impulse at a point. |
| public void | applyTorque(float
about the z-axis (out of the screen), usually in N-m. torque, boolean up the body wake)Apply a torque. |
| public Fixture | |
| public Fixture | createFixture(Shape
the shape to be cloned. shape, float the shape density (set to zero for static bodies). density)Creates a fixture from a shape and attach it to this body. |
| public void | |
| public float | |
| public float | |
| public float | |
| public Array | |
| public float | |
| public float | Returns: the rotational inertia, usually in kg-m^2.Get the rotational inertia of the body about the local origin. |
| public Array | |
| public float | |
| public Vector2 | |
| public Vector2 | Returns: the world velocity of a point.a point in local coordinates. localPoint)Get the world velocity of a local point. |
| public Vector2 | Returns: the world velocity of a point.a point in world coordinates. worldPoint)Get the world linear velocity of a world point attached to this body. |
| public Vector2 | |
| public Vector2 | Returns: the corresponding local point relative to the body's origin.a point in world coordinates. worldPoint)Gets a local point relative to the body's origin given a world point. |
| public Vector2 | Returns: the corresponding local vector.a vector in world coordinates. worldVector)Gets a local vector given a world vector. |
| public float | |
| public MassData | Returns: a struct containing the mass, inertia and center of the body.Get the mass data of the body. |
| public Vector2 | |
| public Transform | |
| public BodyDef. | |
| public Object | |
| public World | |
| public Vector2 | |
| public Vector2 | Returns: the same point expressed in world coordinates.a point on the body measured relative the the body's origin. localPoint)Get the world coordinates of a point given the local coordinates. |
| public Vector2 | Returns: the same vector expressed in world coordinates.a vector fixed in the body. localVector)Get the world coordinates of a vector given the local coordinates. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| private native void | |
| private native void | |
| private native void | |
| private native void | jniApplyLinearImpulse(long addr, float impulseX, float impulseY, float pointX, float pointY, boolean wake)
|
| private native void | |
| private native long | jniCreateFixture(long addr, long shapeAddr, float friction, float restitution, float density, boolean isSensor, short filterCategoryBits, short filterMaskBits, short filterGroupIndex)
|
| private native long | |
| private native float | |
| private native float | |
| private native float | |
| private native float | |
| private native float | |
| private native float | |
| private native void | |
| private native void | jniGetLinearVelocityFromLocalPoint(long addr, float localPointX, float localPointY, long linVelLocAddr)
|
| private native void | jniGetLinearVelocityFromWorldPoint(long addr, float worldPointX, float worldPointY, long linVelWorldAddr)
|
| private native void | |
| private native void | |
| private native void | |
| private native float | |
| private native void | |
| private native void | |
| private native void | |
| private native int | |
| private native void | |
| private native void | |
| private native void | |
| private native boolean | |
| private native boolean | |
| private native boolean | |
| private native boolean | |
| private native boolean | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| private native void | |
| protected void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setAwake(boolean
set to true to wake the body, false to put it to sleep. flag)Set the sleep state of the body. |
| public void | setBullet(boolean flag)
Should this body be treated like a bullet for continuous collision detection? |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setMassData(MassData
the mass properties. data)Set the mass properties to override the mass properties of the fixtures. |
| public void | |
| public void | setTransform(Vector2
the world position of the body's local origin. position, float the world rotation in radians. angle)Set the position of the body's origin and rotation. |
| public void | setTransform(float
the world position on the x-axis x, float the world position on the y-axis y, float the world rotation in radians. angle)Set the position of the body's origin and rotation. |
| public void | |
| public void |
| addr | back to summary |
|---|---|
| protected long addr the address of the body | |
| fixtures | back to summary |
|---|---|
| private Array<Fixture> fixtures Fixtures of this body | |
| joints | back to summary |
|---|---|
| protected Array<JointEdge> joints Joints of this body | |
| linearVelocity | back to summary |
|---|---|
| private final Vector2 linearVelocity | |
| linVelLoc | back to summary |
|---|---|
| public final Vector2 linVelLoc | |
| linVelWorld | back to summary |
|---|---|
| public final Vector2 linVelWorld | |
| localCenter | back to summary |
|---|---|
| private final Vector2 localCenter | |
| localPoint | back to summary |
|---|---|
| private final Vector2 localPoint | |
| localPoint2 | back to summary |
|---|---|
| public final Vector2 localPoint2 | |
| localVector | back to summary |
|---|---|
| public final Vector2 localVector | |
| massData | back to summary |
|---|---|
| private final MassData massData | |
| position | back to summary |
|---|---|
| private final Vector2 position | |
| tmp | back to summary |
|---|---|
| private final float[] tmp temporary float array | |
| tmpBuff | back to summary |
|---|---|
| private final ByteBuffer tmpBuff temporary ByteBuffer | |
| tmpBuffAddress | back to summary |
|---|---|
| private final long tmpBuffAddress | |
| transform | back to summary |
|---|---|
| private final Transform transform | |
| userData | back to summary |
|---|---|
| private Object userData user data | |
| world | back to summary |
|---|---|
| private final World world World | |
| worldCenter | back to summary |
|---|---|
| private final Vector2 worldCenter | |
| worldVector | back to summary |
|---|---|
| private final Vector2 worldVector | |
| Body | back to summary |
|---|---|
| protected Body(World world, long addr) Constructs a new body with the given address
| |
| applyAngularImpulse | back to summary |
|---|---|
| public void applyAngularImpulse(float impulse, boolean wake) Apply an angular impulse.
| |
| applyForce | back to summary |
|---|---|
| public void applyForce(Vector2 force, Vector2 point, boolean wake) Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body. | |
| applyForce | back to summary |
|---|---|
| public void applyForce(float forceX, float forceY, float pointX, float pointY, boolean wake) Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.
| |
| applyForceToCenter | back to summary |
|---|---|
| public void applyForceToCenter(Vector2 force, boolean wake) Apply a force to the center of mass. This wakes up the body.
| |
| applyForceToCenter | back to summary |
|---|---|
| public void applyForceToCenter(float forceX, float forceY, boolean wake) Apply a force to the center of mass. This wakes up the body.
| |
| applyLinearImpulse | back to summary |
|---|---|
| public void applyLinearImpulse(Vector2 impulse, Vector2 point, boolean wake) Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body. | |
| applyLinearImpulse | back to summary |
|---|---|
| public void applyLinearImpulse(float impulseX, float impulseY, float pointX, float pointY, boolean wake) Apply an impulse at a point. This immediately modifies the velocity. It also modifies the angular velocity if the point of application is not at the center of mass. This wakes up the body.
| |
| applyTorque | back to summary |
|---|---|
| public void applyTorque(float torque, boolean wake) Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.
| |
| createFixture | back to summary |
|---|---|
| public Fixture createFixture(FixtureDef def) Creates a fixture and attach it to this body. Use this function if you need to set some fixture parameters, like friction. Otherwise you can create the fixture directly from a shape. If the density is non-zero, this function automatically updates the mass of the body. Contacts are not created until the next time step.
| |
| createFixture | back to summary |
|---|---|
| public Fixture createFixture(Shape shape, float density) Creates a fixture from a shape and attach it to this body. This is a convenience function. Use b2FixtureDef if you need to set parameters like friction, restitution, user data, or filtering. If the density is non-zero, this function automatically updates the mass of the body.
| |
| destroyFixture | back to summary |
|---|---|
| public void destroyFixture(Fixture fixture) Destroy a fixture. This removes the fixture from the broad-phase and destroys all contacts associated with this fixture. This will automatically adjust the mass of the body if the body is dynamic and the fixture has positive density. All fixtures attached to a body are implicitly destroyed when the body is destroyed.
| |
| getAngle | back to summary |
|---|---|
| public float getAngle() Get the angle in radians.
| |
| getAngularDamping | back to summary |
|---|---|
| public float getAngularDamping() Get the angular damping of the body. | |
| getAngularVelocity | back to summary |
|---|---|
| public float getAngularVelocity() Get the angular velocity. | |
| getFixtureList | back to summary |
|---|---|
| public Array Get the list of all fixtures attached to this body. Do not modify the list! | |
| getGravityScale | back to summary |
|---|---|
public float getGravityScale()
| |
| getInertia | back to summary |
|---|---|
| public float getInertia() Get the rotational inertia of the body about the local origin.
| |
| getJointList | back to summary |
|---|---|
| public Array Get the list of all joints attached to this body. Do not modify the list! | |
| getLinearDamping | back to summary |
|---|---|
| public float getLinearDamping() Get the linear damping of the body. | |
| getLinearVelocity | back to summary |
|---|---|
| public Vector2 getLinearVelocity() Get the linear velocity of the center of mass. Note that the same Vector2 instance is returned each time this method is called. | |
| getLinearVelocityFromLocalPoint | back to summary |
|---|---|
| public Vector2 getLinearVelocityFromLocalPoint(Vector2 localPoint) Get the world velocity of a local point. Note that the same Vector2 instance is returned each time this method is called. | |
| getLinearVelocityFromWorldPoint | back to summary |
|---|---|
| public Vector2 getLinearVelocityFromWorldPoint(Vector2 worldPoint) Get the world linear velocity of a world point attached to this body. Note that the same Vector2 instance is returned each time this method is called. | |
| getLocalCenter | back to summary |
|---|---|
| public Vector2 getLocalCenter() Get the local position of the center of mass. Note that the same Vector2 instance is returned each time this method is called. | |
| getLocalPoint | back to summary |
|---|---|
| public Vector2 getLocalPoint(Vector2 worldPoint) Gets a local point relative to the body's origin given a world point. Note that the same Vector2 instance is returned each time this method is called. | |
| getLocalVector | back to summary |
|---|---|
| public Vector2 getLocalVector(Vector2 worldVector) Gets a local vector given a world vector. Note that the same Vector2 instance is returned each time this method is called. | |
| getMass | back to summary |
|---|---|
| public float getMass() Get the total mass of the body.
| |
| getMassData | back to summary |
|---|---|
| public MassData getMassData() Get the mass data of the body.
| |
| getPosition | back to summary |
|---|---|
| public Vector2 getPosition() Get the world body origin position. Note that the same Vector2 instance is returned each time this method is called.
| |
| getTransform | back to summary |
|---|---|
| public Transform getTransform() Get the body transform for the body's origin. | |
| getType | back to summary |
|---|---|
| public BodyDef. Get the type of this body. | |
| getUserData | back to summary |
|---|---|
| public Object getUserData() Get the user data | |
| getWorld | back to summary |
|---|---|
| public World getWorld() Get the parent world of this body. | |
| getWorldCenter | back to summary |
|---|---|
| public Vector2 getWorldCenter() Get the world position of the center of mass. Note that the same Vector2 instance is returned each time this method is called. | |
| getWorldPoint | back to summary |
|---|---|
| public Vector2 getWorldPoint(Vector2 localPoint) Get the world coordinates of a point given the local coordinates. Note that the same Vector2 instance is returned each time this method is called. | |
| getWorldVector | back to summary |
|---|---|
| public Vector2 getWorldVector(Vector2 localVector) Get the world coordinates of a vector given the local coordinates. Note that the same Vector2 instance is returned each time this method is called. | |
| isActive | back to summary |
|---|---|
| public boolean isActive() Get the active state of the body. | |
| isAwake | back to summary |
|---|---|
| public boolean isAwake() Get the sleeping state of this body.
| |
| isBullet | back to summary |
|---|---|
| public boolean isBullet() Is this body treated like a bullet for continuous collision detection? | |
| isFixedRotation | back to summary |
|---|---|
| public boolean isFixedRotation() Does this body have fixed rotation? | |
| isSleepingAllowed | back to summary |
|---|---|
| public boolean isSleepingAllowed() Is this body allowed to sleep | |
| jniApplyAngularImpulse | back to summary |
|---|---|
| private native void jniApplyAngularImpulse(long addr, float impulse, boolean wake) | |
| jniApplyForce | back to summary |
|---|---|
| private native void jniApplyForce(long addr, float forceX, float forceY, float pointX, float pointY, boolean wake) | |
| jniApplyForceToCenter | back to summary |
|---|---|
| private native void jniApplyForceToCenter(long addr, float forceX, float forceY, boolean wake) | |
| jniApplyLinearImpulse | back to summary |
|---|---|
| private native void jniApplyLinearImpulse(long addr, float impulseX, float impulseY, float pointX, float pointY, boolean wake) | |
| jniApplyTorque | back to summary |
|---|---|
| private native void jniApplyTorque(long addr, float torque, boolean wake) | |
| jniCreateFixture | back to summary |
|---|---|
| private native long jniCreateFixture(long addr, long shapeAddr, float friction, float restitution, float density, boolean isSensor, short filterCategoryBits, short filterMaskBits, short filterGroupIndex) | |
| jniCreateFixture | back to summary |
|---|---|
| private native long jniCreateFixture(long addr, long shapeAddr, float density) | |
| jniGetAngle | back to summary |
|---|---|
| private native float jniGetAngle(long addr) | |
| jniGetAngularDamping | back to summary |
|---|---|
| private native float jniGetAngularDamping(long addr) | |
| jniGetAngularVelocity | back to summary |
|---|---|
| private native float jniGetAngularVelocity(long addr) | |
| jniGetGravityScale | back to summary |
|---|---|
| private native float jniGetGravityScale(long addr) | |
| jniGetInertia | back to summary |
|---|---|
| private native float jniGetInertia(long addr) | |
| jniGetLinearDamping | back to summary |
|---|---|
| private native float jniGetLinearDamping(long addr) | |
| jniGetLinearVelocity | back to summary |
|---|---|
| private native void jniGetLinearVelocity(long addr, long linearVelocityAddr) | |
| jniGetLinearVelocityFromLocalPoint | back to summary |
|---|---|
| private native void jniGetLinearVelocityFromLocalPoint(long addr, float localPointX, float localPointY, long linVelLocAddr) | |
| jniGetLinearVelocityFromWorldPoint | back to summary |
|---|---|
| private native void jniGetLinearVelocityFromWorldPoint(long addr, float worldPointX, float worldPointY, long linVelWorldAddr) | |
| jniGetLocalCenter | back to summary |
|---|---|
| private native void jniGetLocalCenter(long addr, long localCenterAddr) | |
| jniGetLocalPoint | back to summary |
|---|---|
| private native void jniGetLocalPoint(long addr, float worldPointX, float worldPointY, long localPointAddr) | |
| jniGetLocalVector | back to summary |
|---|---|
| private native void jniGetLocalVector(long addr, float worldVectorX, float worldVectorY, long worldVectorAddr) | |
| jniGetMass | back to summary |
|---|---|
| private native float jniGetMass(long addr) | |
| jniGetMassData | back to summary |
|---|---|
| private native void jniGetMassData(long addr, float[] massData) | |
| jniGetPosition | back to summary |
|---|---|
| private native void jniGetPosition(long addr, long positionAddr) | |
| jniGetTransform | back to summary |
|---|---|
| private native void jniGetTransform(long addr, float[] vals) | |
| jniGetType | back to summary |
|---|---|
| private native int jniGetType(long addr) | |
| jniGetWorldCenter | back to summary |
|---|---|
| private native void jniGetWorldCenter(long addr, long worldCenterAddr) | |
| jniGetWorldPoint | back to summary |
|---|---|
| private native void jniGetWorldPoint(long addr, float localPointX, float localPointY, long worldPointAddr) | |
| jniGetWorldVector | back to summary |
|---|---|
| private native void jniGetWorldVector(long addr, float localVectorX, float localVectorY, long worldVectorAddr) | |
| jniIsActive | back to summary |
|---|---|
| private native boolean jniIsActive(long addr) | |
| jniIsAwake | back to summary |
|---|---|
| private native boolean jniIsAwake(long addr) | |
| jniIsBullet | back to summary |
|---|---|
| private native boolean jniIsBullet(long addr) | |
| jniIsFixedRotation | back to summary |
|---|---|
| private native boolean jniIsFixedRotation(long addr) | |
| jniIsSleepingAllowed | back to summary |
|---|---|
| private native boolean jniIsSleepingAllowed(long addr) | |
| jniResetMassData | back to summary |
|---|---|
| private native void jniResetMassData(long addr) | |
| jniSetActive | back to summary |
|---|---|
| private native void jniSetActive(long addr, boolean flag) | |
| jniSetAngularDamping | back to summary |
|---|---|
| private native void jniSetAngularDamping(long addr, float angularDamping) | |
| jniSetAngularVelocity | back to summary |
|---|---|
| private native void jniSetAngularVelocity(long addr, float omega) | |
| jniSetAwake | back to summary |
|---|---|
| private native void jniSetAwake(long addr, boolean flag) | |
| jniSetBullet | back to summary |
|---|---|
| private native void jniSetBullet(long addr, boolean flag) | |
| jniSetFixedRotation | back to summary |
|---|---|
| private native void jniSetFixedRotation(long addr, boolean flag) | |
| jniSetGravityScale | back to summary |
|---|---|
| private native void jniSetGravityScale(long addr, float scale) | |
| jniSetLinearDamping | back to summary |
|---|---|
| private native void jniSetLinearDamping(long addr, float linearDamping) | |
| jniSetLinearVelocity | back to summary |
|---|---|
| private native void jniSetLinearVelocity(long addr, float x, float y) | |
| jniSetMassData | back to summary |
|---|---|
| private native void jniSetMassData(long addr, float mass, float centerX, float centerY, float I) | |
| jniSetSleepingAllowed | back to summary |
|---|---|
| private native void jniSetSleepingAllowed(long addr, boolean flag) | |
| jniSetTransform | back to summary |
|---|---|
| private native void jniSetTransform(long addr, float positionX, float positionY, float angle) | |
| jniSetType | back to summary |
|---|---|
| private native void jniSetType(long addr, int type) | |
| reset | back to summary |
|---|---|
| protected void reset(long addr) Resets this body after fetching it from the | |
| resetMassData | back to summary |
|---|---|
| public void resetMassData() This resets the mass properties to the sum of the mass properties of the fixtures. This normally does not need to be called unless you called SetMassData to override the mass and you later want to reset the mass. | |
| setActive | back to summary |
|---|---|
| public void setActive(boolean flag) Set the active state of the body. An inactive body is not simulated and cannot be collided with or woken up. If you pass a flag of true, all fixtures will be added to the broad-phase. If you pass a flag of false, all fixtures will be removed from the broad-phase and all contacts will be destroyed. Fixtures and joints are otherwise unaffected. You may continue to create/destroy fixtures and joints on inactive bodies. Fixtures on an inactive body are implicitly inactive and will not participate in collisions, ray-casts, or queries. Joints connected to an inactive body are implicitly inactive. An inactive body is still owned by a b2World object and remains in the body list. | |
| setAngularDamping | back to summary |
|---|---|
| public void setAngularDamping(float angularDamping) Set the angular damping of the body. | |
| setAngularVelocity | back to summary |
|---|---|
| public void setAngularVelocity(float omega) Set the angular velocity. | |
| setAwake | back to summary |
|---|---|
| public void setAwake(boolean flag) Set the sleep state of the body. A sleeping body has very low CPU cost.
| |
| setBullet | back to summary |
|---|---|
| public void setBullet(boolean flag) Should this body be treated like a bullet for continuous collision detection? | |
| setFixedRotation | back to summary |
|---|---|
| public void setFixedRotation(boolean flag) Set this body to have fixed rotation. This causes the mass to be reset. | |
| setGravityScale | back to summary |
|---|---|
| public void setGravityScale(float scale) Sets the gravity scale of the body | |
| setLinearDamping | back to summary |
|---|---|
| public void setLinearDamping(float linearDamping) Set the linear damping of the body. | |
| setLinearVelocity | back to summary |
|---|---|
| public void setLinearVelocity(Vector2 v) Set the linear velocity of the center of mass. | |
| setLinearVelocity | back to summary |
|---|---|
| public void setLinearVelocity(float vX, float vY) Set the linear velocity of the center of mass. | |
| setMassData | back to summary |
|---|---|
| public void setMassData(MassData data) Set the mass properties to override the mass properties of the fixtures. Note that this changes the center of mass position. Note that creating or destroying fixtures can also alter the mass. This function has no effect if the body isn't dynamic.
| |
| setSleepingAllowed | back to summary |
|---|---|
| public void setSleepingAllowed(boolean flag) You can disable sleeping on this body. If you disable sleeping, the | |
| setTransform | back to summary |
|---|---|
| public void setTransform(Vector2 position, float angle) Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior.
| |
| setTransform | back to summary |
|---|---|
| public void setTransform(float x, float y, float angle) Set the position of the body's origin and rotation. This breaks any contacts and wakes the other bodies. Manipulating a body's transform may cause non-physical behavior.
| |
| setType | back to summary |
|---|---|
| public void setType(BodyDef. Set the type of this body. This may alter the mass and velocity. | |
| setUserData | back to summary |
|---|---|
| public void setUserData(Object userData) Set the user data | |