Physics Object

From OxeyeWiki

(Difference between revisions)
Jump to: navigation, search
m
m
 
Line 1: Line 1:
 +
{{Physics}}
The physics object in DaisyMoon is a wrapper around a Box2D instance. The wrapper controls Box2D entities (bodies with shapes and their collision data) and the Box2D physics world. Communication between DaisyMoon and the entities is done by handling body identifiers, which are simple integers.
The physics object in DaisyMoon is a wrapper around a Box2D instance. The wrapper controls Box2D entities (bodies with shapes and their collision data) and the Box2D physics world. Communication between DaisyMoon and the entities is done by handling body identifiers, which are simple integers.
Line 29: Line 30:
* [http://www.box2d.org Box2D website]
* [http://www.box2d.org Box2D website]
-
 
-
{{Physics}}
 

Latest revision as of 13:03, 7 February 2010

Daisymoon Physics Lib

The physics object in DaisyMoon is a wrapper around a Box2D instance. The wrapper controls Box2D entities (bodies with shapes and their collision data) and the Box2D physics world. Communication between DaisyMoon and the entities is done by handling body identifiers, which are simple integers.

For detailed documentation on how the physics work, please refer to the Box2D documentation.

Contents

Concepts

World Resolution

The Box2D works with meters instead of pixels. In most cases this means that you need to convert coordinates when sending to or recieving from the physics object. From our experience, 32 pixels per meter is a good resolution to use.

local physResolution = 1 / 32
local nbrOfIterations = 10

Working with the Physics Object

Creating

physics = Physics(0, 0, width * physResolution, height * physResolution, gravityX, gravityY)

Updating

physics:update(timeStep, nbrOfIterations)

Using Entities

Using Joints

External Resources

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox