Version: beta
FUNCTION | |
---|---|
b2d.body.apply_angular_impulse() | Apply an angular impulse. |
b2d.body.apply_force() | Apply a force at a world point. If the force is no... |
b2d.body.apply_force_to_center() | Apply a force to the center of mass. This wakes up the body. |
b2d.body.apply_linear_impulse() | Apply an impulse at a point. This immediately modi... |
b2d.body.apply_torque() | Apply a torque. This affects the angular velocity ... |
b2d.body.dump() | Print the body representation to the log output |
b2d.body.get_angular_damping() | Get the angular damping of the body. |
b2d.body.get_angular_velocity() | Set the angular velocity. |
b2d.body.get_angular_velocity() | Get the angular velocity. |
b2d.body.get_gravity_scale() | Get the gravity scale of the body. |
b2d.body.get_inertia() | Get the rotational inertia of the body about the local origin. |
b2d.body.get_linear_damping() | Get the linear damping of the body. |
b2d.body.get_linear_velocity() | Get the linear velocity of the center of mass. |
b2d.body.get_linear_velocity_from_world_point() | Get the world linear velocity of a world point attached to this body. |
b2d.body.get_linear_velocity_from_world_point() | Get the world velocity of a local point. |
b2d.body.get_local_center() | Get the local position of the center of mass. |
b2d.body.get_local_point() | Gets a local point relative to the body's origin given a world point. |
b2d.body.get_local_vector() | Gets a local vector given a world vector. |
b2d.body.get_mass() | Get the total mass of the body. |
b2d.body.get_next() | Get the next body in the world's body list. |
b2d.body.get_position() | Get the world body origin position. |
b2d.body.get_type() | Get the type of this body. |
b2d.body.get_world() | Get the parent world of this body. |
b2d.body.get_world_center() | Get the angle in radians. |
b2d.body.get_world_center() | Get the world position of the center of mass. |
b2d.body.get_world_point() | Get the world coordinates of a point given the local coordinates. |
b2d.body.get_world_vector() | Get the world coordinates of a vector given the local coordinates. |
b2d.body.is_active() | Get the active state of the body. |
b2d.body.is_awake() | Get the sleeping state of this body. |
b2d.body.is_bullet() | Is this body in bullet mode |
b2d.body.is_fixed_rotation() | Does this body have fixed rotation? |
b2d.body.is_sleeping_allowed() | Is this body allowed to sleep |
b2d.body.reset_mass_data() | This resets the mass properties to the sum of the ... |
b2d.body.set_active() | Set the active state of the body |
b2d.body.set_angular_damping() | Set the angular damping of the body. |
b2d.body.set_awake() | Set the sleep state of the body. A sleeping body has very low CPU cost. |
b2d.body.set_bullet() | Should this body be treated like a bullet for continuous collision detection? |
b2d.body.set_fixed_rotation() | Set this body to have fixed rotation. This causes the mass to be reset. |
b2d.body.set_gravity_scale() | Set the gravity scale of the body. |
b2d.body.set_linear_damping() | Set the linear damping of the body. |
b2d.body.set_linear_velocity() | Set the linear velocity of the center of mass. |
b2d.body.set_sleeping_allowed() | You can disable sleeping on this body. If you disable sleeping, the body will be woken. |
b2d.body.set_transform() | Set the position of the body's origin and rotation |
b2d.body.set_type() | Set the type of this body. This may alter the mass and velocity. |
CONSTANT | |
---|---|
b2d.body.B2_DYNAMIC_BODY | Dynamic body |
b2d.body.B2_KINEMATIC_BODY | Kinematic body |
b2d.body.B2_STATIC_BODY | Static (immovable) body |
b2d.body.apply_angular_impulse(impulse)
Apply an angular impulse.
PARAMETERS
impulse |
number |
impulse the angular impulse in units of kgmm/s |
b2d.body.apply_force(force,point)
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.
PARAMETERS
force |
vmath.vector3 |
the world force vector, usually in Newtons (N). |
point |
vmath.vector3 |
the world position of the point of application. |
b2d.body.apply_force_to_center(force)
Apply a force to the center of mass. This wakes up the body.
PARAMETERS
force |
vmath.vector3 |
the world force vector, usually in Newtons (N). |
b2d.body.apply_linear_impulse(impulse,point)
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.
PARAMETERS
impulse |
vmath.vector3 |
the world impulse vector, usually in N-seconds or kg-m/s. |
point |
vmath.vector3 |
the world position of the point of application. |
b2d.body.apply_torque(torque)
Apply a torque. This affects the angular velocity without affecting the linear velocity of the center of mass. This wakes up the body.
PARAMETERS
torque |
number |
torque about the z-axis (out of the screen), usually in N-m. |
b2d.body.dump()
Print the body representation to the log output
PARAMETERS
None
b2d.body.get_angular_damping()
Get the angular damping of the body.
PARAMETERS
None
RETURNS
damping |
number | the damping |
b2d.body.get_angular_velocity(omega)
Set the angular velocity.
PARAMETERS
omega |
number |
the new angular velocity in radians/second. |
b2d.body.get_angular_velocity()
Get the angular velocity.
PARAMETERS
None
RETURNS
velocity |
number | the angular velocity in radians/second. |
b2d.body.get_gravity_scale()
Get the gravity scale of the body.
PARAMETERS
None
RETURNS
scale |
number | the scale |
b2d.body.get_inertia()
Get the rotational inertia of the body about the local origin.
PARAMETERS
None
RETURNS
inertia |
number | the rotational inertia, usually in kg-m^2. |
b2d.body.get_linear_damping()
Get the linear damping of the body.
PARAMETERS
None
RETURNS
damping |
number | the damping |
b2d.body.get_linear_velocity()
Get the linear velocity of the center of mass.
PARAMETERS
None
RETURNS
velocity |
vmath.vector3 | the linear velocity of the center of mass. |
b2d.body.get_linear_velocity_from_world_point(world_point)
Get the world linear velocity of a world point attached to this body.
PARAMETERS
world_point |
vmath.vector3 |
a point in world coordinates. |
RETURNS
velocity |
vmath.vector3 | the world velocity of a point. |
b2d.body.get_linear_velocity_from_world_point(world_point)
Get the world velocity of a local point.
PARAMETERS
world_point |
vmath.vector3 |
a point in local coordinates. |
RETURNS
velocity |
vmath.vector3 | the world velocity of a point. |
b2d.body.get_local_center()
Get the local position of the center of mass.
PARAMETERS
None
RETURNS
center |
vmath.vector3 | Get the local position of the center of mass. |
b2d.body.get_local_point(world_point)
Gets a local point relative to the body's origin given a world point.
PARAMETERS
world_point |
vmath.vector3 |
a point in world coordinates. |
RETURNS
vector |
vmath.vector3 | the corresponding local point relative to the body's origin. |
b2d.body.get_local_vector(world_vector)
Gets a local vector given a world vector.
PARAMETERS
world_vector |
vmath.vector3 |
a vector in world coordinates. |
RETURNS
vector |
vmath.vector3 | the corresponding local vector. |
b2d.body.get_mass()
Get the total mass of the body.
PARAMETERS
None
RETURNS
mass |
number | the mass, usually in kilograms (kg). |
b2d.body.get_next()
Get the next body in the world's body list.
PARAMETERS
None
RETURNS
body |
b2Body | the next body |
b2d.body.get_position()
Get the world body origin position.
PARAMETERS
None
RETURNS
position |
vmath.vector3 | the world position of the body's origin. |
b2d.body.get_type()
Get the type of this body.
PARAMETERS
None
RETURNS
type |
b2BodyType | the body type |
b2d.body.get_world()
Get the parent world of this body.
PARAMETERS
None
RETURNS
world |
b2World |
b2d.body.get_world_center()
Get the angle in radians.
PARAMETERS
None
RETURNS
angle |
number | the current world rotation angle in radians. |
b2d.body.get_world_center()
Get the world position of the center of mass.
PARAMETERS
None
RETURNS
center |
vmath.vector3 | Get the world position of the center of mass. |
b2d.body.get_world_point(local_vector)
Get the world coordinates of a point given the local coordinates.
PARAMETERS
local_vector |
vmath.vector3 |
localPoint a point on the body measured relative the the body's origin. |
RETURNS
vector |
vmath.vector3 | the same point expressed in world coordinates. |
b2d.body.get_world_vector(local_vector)
Get the world coordinates of a vector given the local coordinates.
PARAMETERS
local_vector |
vmath.vector3 |
a vector fixed in the body. |
RETURNS
vector |
vmath.vector3 | the same vector expressed in world coordinates. |
b2d.body.is_active()
Get the active state of the body.
PARAMETERS
None
RETURNS
enabled |
bool | is the body active |
b2d.body.is_awake()
Get the sleeping state of this body.
PARAMETERS
None
RETURNS
enabled |
bool | true if the body is awake, false if it's sleeping. |
b2d.body.is_bullet()
Is this body in bullet mode
PARAMETERS
None
RETURNS
enabled |
bool | true if the body is in bullet mode |
b2d.body.is_fixed_rotation()
Does this body have fixed rotation?
PARAMETERS
None
RETURNS
enabled |
bool | is the rotation fixed |
b2d.body.is_sleeping_allowed()
Is this body allowed to sleep
PARAMETERS
None
RETURNS
enabled |
bool | true if the body is allowed to sleep |
b2d.body.reset_mass_data()
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
PARAMETERS
None
b2d.body.set_active(enable)
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.
PARAMETERS
enable |
bool |
true if the body should be active |
b2d.body.set_angular_damping(damping)
Set the angular damping of the body.
PARAMETERS
damping |
number |
the damping |
b2d.body.set_awake(enable)
Set the sleep state of the body. A sleeping body has very low CPU cost.
PARAMETERS
enable |
bool |
flag set to false to put body to sleep, true to wake it. |
b2d.body.set_bullet(enable)
Should this body be treated like a bullet for continuous collision detection?
PARAMETERS
enable |
bool |
if true, the body will be in bullet mode |
b2d.body.set_fixed_rotation(enable)
Set this body to have fixed rotation. This causes the mass to be reset.
PARAMETERS
enable |
bool |
true if the rotation should be fixed |
b2d.body.set_gravity_scale(scale)
Set the gravity scale of the body.
PARAMETERS
scale |
number |
the scale |
b2d.body.set_linear_damping(damping)
Set the linear damping of the body.
PARAMETERS
damping |
number |
the damping |
b2d.body.set_linear_velocity(velocity)
Set the linear velocity of the center of mass.
PARAMETERS
velocity |
vmath.vector3 |
the new linear velocity of the center of mass. |
b2d.body.set_sleeping_allowed(enable)
You can disable sleeping on this body. If you disable sleeping, the body will be woken.
PARAMETERS
enable |
bool |
if false, the body will never sleep, and consume more CPU |
b2d.body.set_transform(position,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.
PARAMETERS
position |
vmath.vector3 |
the world position of the body's local origin. |
angle |
number |
the world position of the body's local origin. |
b2d.body.set_type(type)
Set the type of this body. This may alter the mass and velocity.
PARAMETERS
type |
b2BodyType |
the body type |
Dynamic body
Kinematic body
Static (immovable) body