Version 3, last updated by crazy-chris at March 30, 2008 13:05 UTC

Information about Elements

 

  1. General Information about elements
  2. The Elements coordinate system.
  3. Units in elements
  4. Building elements

 

1. General information about elements

Elements is

  • An easy to use API for integrating 2d physics into your apps using python.
  • A python wrapper around the Box2D physics engine.
  • A collection of demo's,simulations & tools.
  • Fast (Python interface, C speed)

The elements project previoulsy support the Chipmunk 2D engine, but has since switches to using the box2D physics engine exclusively.

 

2. The coordinate systems

 Elements        Box2D           Pygame
  +y              +y              +-----> +x
  ^               ^               |
  |               |               |
  |               |               V
  +-----> +x      +-----> +x      +y

    You can change Element's input coordinate system, so you can directly
    pass the pygame coordinates. Do so with elements.inputAxisOrigin(left, top)
    > For pygame, you'd inputAxisOrigin(left=True, top=True)

 

3. The elements unit system

Elements can take either pixels or meters as input for lengths/positions/... However, internally everything is stored in KMS and in the same coordinate system as Box2d.


By default it is set to meters, but can be changed to pixels with:
> world.set_inputUnit(INPUT_PIXELS)
  
The output to the drawing methods is always done in pixels for the moment.