2010 October 12 / j|d|a|v|i|s|@|c|a|r|l|e|t|o|n|.|e|d|u

Body3D

A rigid body in a 3D scene. The visual appearance of the body is determined by a Mesh, a set of Textures, and a set of uniform properties. The dynamics of the body are handled by an underlying Open Dynamics Engine Body object. All messages that the Body3D receives and doesn't recognize are delegated to the ODE Body. In most cases this means that you can talk to Body3D as if it's a subclass of ODE's Body. For example, you can set the Body3D's position by calling myBody3D.setPosition(xyz) instead of myBody3D.getBody().setPosition(xyz).

__init__(self, mesh=None, textures=[], uniforms=[], world=None)

Initializes the body with the given Mesh, list of Textures, and list of uniforms. These data must be compatible with whichever renderer the body is eventually attached to. The world argument should be an ODE World object, where the body will live; if world is None, then the body lives in the world of the current window.

getBody(self)

Returns the underlying ODE Body, which is never None. Note however that in most cases you do not need to get the ODE Body; all messages that the Body3D receives, that it doesn't recognize, are delegated to the ODE Body automatically.

setMesh(self, mesh)

Sets the mesh. The user is responsible for its being compatible with the renderer.

getMesh(self)

Returns the mesh.

getTextures(self)

Returns the list of textures, which the user can alter (append, pop, etc.) as desired, as long as they remain compatible with the renderer.

getUniforms(self)

Returns the list of uniform properties, which the user can alter (append, pop, etc.) as desired, as long as they remain compatible with the renderer.

translate(self, v)

Changes the position by adding v = (dx, dy, dz).

rotate(self, angle, axis)

Prepends the given angle-axis rotation to the receiver's orientation.

revolve(self, angle, axis, center)

Revolves the body about the given center point by the angle-axis rotation; changes position but not orientation.

revolveRotate(self, angle, axis, center)

Revolves the body about the given center point by the given angle-axis rotation, also prepending the rotation to the receiver's orientation, so that the same side of the member always faces the center point.