Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
PhysicsCreationFactory Class Reference

Factory class for creating physics bodies in the Box2D world. More...

#include <physics_creation_factory.h>

Public Member Functions

 PhysicsCreationFactory (b2WorldId world_id)
 
Body2D create_body (Vector3 position, BodyType2D::Type type, Component *component)
 Create a physics body in the Box2D world.
 

Static Public Member Functions

static Body2D create_box_fixture (Body2D body, Point offset, float width, float height, PhysicsCreationFlags flags)
 Create a box-shaped fixture for a given body.
 
static Body2D create_circle_fixture (Body2D body, Point offset, float radius, PhysicsCreationFlags flags)
 Create a circle-shaped fixture for a given body.
 
static void destroy_body (Body2D &body)
 Destroy a body given its identifier.
 

Detailed Description

Factory class for creating physics bodies in the Box2D world.

This class provides methods to create various types of physics bodies (such as boxes and circles) with specified properties and flags.

Constructor & Destructor Documentation

◆ PhysicsCreationFactory()

PhysicsCreationFactory::PhysicsCreationFactory ( b2WorldId  world_id)

Member Function Documentation

◆ create_body()

Body2D PhysicsCreationFactory::create_body ( Vector3  position,
BodyType2D::Type  type,
Component component 
)

Create a physics body in the Box2D world.

Parameters
positionThe initial position of the body
typeThe type of the body (static, dynamic, kinematic)
componentThe component associated with the body
Returns
b2BodyId The identifier of the created body

◆ create_box_fixture()

static Body2D PhysicsCreationFactory::create_box_fixture ( Body2D  body,
Point  offset,
float  width,
float  height,
PhysicsCreationFlags  flags 
)
static

Create a box-shaped fixture for a given body.

Parameters
bodyThe identifier of the body to attach the fixture to
widthThe width of the box
heightThe height of the box
flagsThe creation flags for the fixture
Returns
b2BodyId The identifier of the created fixture

◆ create_circle_fixture()

static Body2D PhysicsCreationFactory::create_circle_fixture ( Body2D  body,
Point  offset,
float  radius,
PhysicsCreationFlags  flags 
)
static

Create a circle-shaped fixture for a given body.

Parameters
bodyThe identifier of the body to attach the fixture to
radiusThe radius of the circle
flagsThe creation flags for the fixture
componentThe component associated with the fixture
Returns
b2BodyId The identifier of the created fixture

◆ destroy_body()

static void PhysicsCreationFactory::destroy_body ( Body2D body)
static

Destroy a body given its identifier.

Parameters
body_idThe identifier of the body to destroy

The documentation for this class was generated from the following file: