body Package

body Package

bodybase Module

class body.bodybase.BodyBase[source]

The Base of any body in the world

Provides a set of basic accessor functions for all bodies.

get_position()[source]

Returns position as a 3 part tuple:(x,y,z).

set_material(material)[source]

Sets the material of the body. DO NOT USE

get_group()[source]

Returns the collisions group of the body.

set_group(group)[source]

Puts the body in the provided collision group.

set_user_data(data)[source]

Sets user data to be stored in the body.

get_user_data()[source]

Returns user data currently stored in the body.

set_position(pos=None, rot=None)[source]

Sets the position of the object and/or its orientation.

apply_force(force, pos=(0, 0, 0))[source]

Applies a force to the object for a single step at an optional offset in world coordinates.

apply_impulse(impulse, pos=(0, 0, 0))[source]

Applies an impulse to the object for a single step at an optional offset in world coordinates.

apply_angular_impulse(impulse)[source]

Applies an angular impulse to the object for a single step.

get_velocity()[source]

Returns the linear velocity of the body.

set_velocity()[source]

Sets the linear velocity of the body.

get_angular_velocity()[source]

Returns the angular velocity of the body.

set_angular_velocity()[source]

Sets the angular velocity of the body.

is_active()[source]

Returns true if the body is not asleep.

set_active(active)[source]

Sets the body to active or not.

notify_collision(enabled)

informs the body that it can at any time have its current collision points requested

get_contacts()

returns the bodies that this body is currently in contact with.

mass[source]

the mass of the object

box Module

class body.box.Box(rect, mass=None, density=None, static=False)[source]

Bases: body.bodybase.BodyBase

classmethod create(rect, mass=None, density=None, static=False)

constructs a box and adds it to the world

rect: a 6 part tuple with x,y,z,width,height,depth. mass: the mass of the object, if mass is specified it will be used. density: if no mass is specified and a density is, the mass will be calculated from the density and the volumne. static: used to create this object static, if static is true, mass will be ignored

get_size()[source]

returns the size of the object in a 3 part tuple

delete()

capsule Module

class body.capsule.Capsule(rect, mass=None, density=None, static=False)[source]

Bases: body.bodybase.BodyBase

classmethod create(rect, mass=None, density=None, static=False)

constructs a box and adds it to the world

rect: a 5 part tuple with x,y,z,radius,length. Note: if a 6 part rect is passed in, the width will be taken as the radius and the height as the length, the depth will be ignored. mass: the mass of the object, if mass is specified it will be used. density: if no mass is specified and a density is, the mass will be calculated from the density and the volumne. static: used to create this object static, if static is true, mass will be ignored

get_size()[source]

returns the size of the object in a 2 part tuple

delete()

convex Module

class body.convex.Convex(pos, points, mass=None, density=None)[source]

Bases: body.bodybase.BodyBase

get_point()[source]

returns the points of the object

get_metrics()[source]

returns the pos of the object in a 3 part tuple

generic_body Module

class body.generic_body.GenericBody(pos, mass=None, density=None)[source]

Bases: body.bodybase.BodyBase

setDynamicsType(dynType)[source]

Sets the body to dynamic, static, or kinematic

dynType: “dynamic”, “static” or “kinematic”

setMass(mass=None, density=None)[source]

density: if no mass is specified and a density is, the mass will be calculated from the density and the volumne.

setInertia(Ixx, Iyy, Izz)[source]

density: if no mass is specified and a density is, the mass will be calculated from the density and the volumne.

connectGeometry(geometry)[source]

connects a geometry

getGeometrys()[source]

returns a list of geometries

removeGrometry(geometry)[source]

removes a geometry if found

heightmap_terrain Module

class body.heightmap_terrain.HeightMapTerrain(pos, size, height_map)[source]

Bases: body.bodybase.BodyBase

an height map terrain object

mesh_terrain Module

class body.mesh_terrain.MeshTerrain(pos, points, triangles)[source]

Bases: body.bodybase.BodyBase

a mesh based terrain object

oriented_terrain Module

class body.oriented_terrain.OrientedTerrain(pos, normal, min_size)[source]

Bases: body.bodybase.BodyBase

an oriented terrain object

sphere Module

class body.sphere.Sphere(rect, mass=None, density=None, static=False)[source]

Bases: body.bodybase.BodyBase

classmethod create(rect, mass=None, density=None, static=False)

constructs a sphere and adds it to the world

rect: a 6 part tuple with x,y,z,width,height,depth. mass: the mass of the object, if mass is specified it will be used. density: if no mass is specified and a density is, the mass will be calculated from the density and the volumne. static: used to create this object static, if static is true, mass will be ignored

get_size()[source]

returns the radius of the sphere

delete()

terrain Module

class body.terrain.Terrain(pos, min_size)[source]

Bases: body.bodybase.BodyBase

a simple terrain object

classmethod create(pos, min_size)

pos: position of the plane min_size: the minimumsize of the plane

delete()