Skip to content

Physics

miguel edited this page May 13, 2019 · 3 revisions

This framework fully integrates with box2d and box2dlights: physics

Using the PhysicsManager

Simply access the PhysicsManager via the GameContext:

GameWorld gameWorld = context.getGameWorld();
GameObject gameObject = gameWorld.newGameObject();

PhysicsManager physicsManager = context.getPhysicsManager();
BodyDef bodyDef = new BodyDef(/* create body def here */);
FixtureDef fixtureDef = new FixtureDef(/* create FixtureDef here */);

physicsManager.attachBody(bodyDef, fixtureDef, gameObject);

First of all, we create a new game object. Afterwards we are defining a BodyDef and FixtureDef which describes the shape of the physics object as well as its physical properties. Then we simply attach it to the game object. At runtime, braingdx keeps care of updating the GameObject respectively.

Table of Contents

πŸ’» Screens

πŸŽ₯ Graphics

🍯 Asset Management

🌏 Game World

🐡 Behaviors

πŸ”¦ Lighting

πŸ€ Physics

✨ Particles

πŸƒ Animations

πŸ”¬ UI Components

πŸ”‰ Audio

Clone this wiki locally