Package com.codename1.gaming.physics
2D rigid body physics for Codename One games.
This package provides an idiomatic Codename One wrapper -- PhysicsWorld,
PhysicsBody, ContactListener and friends -- around a 2D rigid body
simulation. Bodies are linked to com.codename1.gaming.Sprites through
PhysicsLinkable, and the world is stepped from a
com.codename1.gaming.GameView update loop. Everything is expressed in screen
pixels; the conversion to the simulation's meter based, y-up coordinate system
is handled internally (see PhysicsWorld#setPixelsPerMeter(float)).
The simulation engine in the sub package box2d is a derived work of JBox2D
(a Java port of Erin Catto's Box2D), used under the BSD 2-Clause license. The
original copyright and license notices are retained in those source files; see
the project NOTICE for attribution. Being pure Java, the engine runs on every
Codename One platform -- including iOS, where it is translated to C by ParparVM
-- with no native code.
-
ClassDescriptionThe kind of a
PhysicsBody.Notified when bodies in aPhysicsWorldstart and stop touching.A rigid body in aPhysicsWorld, wrapping a shaded Box2D body.A contact between two bodies, passed to aContactListener.Implemented by anything aPhysicsBodycan drive -- typically acom.codename1.gaming.Sprite.A 2D rigid body physics world, wrapping a shaded Box2D (JBox2D) simulation in an idiomatic Codename One API.