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

Flags for creating physics bodies. More...

#include <physics_creation_flags.h>

Public Attributes

bool dynamic {true}
 Density of the body.
 
bool enable_rotation {false}
 Whether to enable rotation for the body.
 
bool sensor {false}
 Whether the body is a sensor.
 
bool enable_contact_events {true}
 Whether to enable contact events for the body.
 
bool enable_sensor_events {true}
 Whether to enable sensor events for the body.
 
bool is_bullet {false}
 Whether the body is treated as a bullet.
 
uint16_t category = default_collision_category
 Collision category filtering.
 
uint16_t mask = default_collision_mask
 Collision mask filtering.
 
float desired_mass {1.0f}
 Desired mass of the body.
 
float friction {0.5f}
 Friction coefficient of the body.
 
float bounciness {0.5f}
 Bounciness (restitution) of the body.
 

Detailed Description

Flags for creating physics bodies.

This struct encapsulates various options that can be set when creating physics bodies in the Box2D world.

Member Data Documentation

◆ bounciness

float PhysicsCreationFlags::bounciness {0.5f}

Bounciness (restitution) of the body.

Default is 0.5f. This value defines how bouncy the body is during collisions.

◆ category

uint16_t PhysicsCreationFlags::category = default_collision_category

Collision category filtering.

Default is 0x0001. This value defines the category of the body for collision filtering. E.g, 0x0002 for player, 0x0004 for enemies.

◆ desired_mass

float PhysicsCreationFlags::desired_mass {1.0f}

Desired mass of the body.

Default is 1.0f. This value sets the mass of the body directly.

◆ dynamic

bool PhysicsCreationFlags::dynamic {true}

Density of the body.

Default is 1.0f if not specified.

◆ enable_contact_events

bool PhysicsCreationFlags::enable_contact_events {true}

Whether to enable contact events for the body.

Default is true. If true, the body will generate contact events on collisions.

◆ enable_rotation

bool PhysicsCreationFlags::enable_rotation {false}

Whether to enable rotation for the body.

Default is false.

◆ enable_sensor_events

bool PhysicsCreationFlags::enable_sensor_events {true}

Whether to enable sensor events for the body.

Default is true. If true, the body will generate events when other bodies enter/exit the sensor.

Note
: This is an optimization flag but a TRICKY one. Sensors need this, aswell as their collidable objects. Supports: kinematic, dynamic and static.

◆ friction

float PhysicsCreationFlags::friction {0.5f}

Friction coefficient of the body.

Default is 0.5f. This value defines the friction applied to the body during collisions.

◆ is_bullet

bool PhysicsCreationFlags::is_bullet {false}

Whether the body is treated as a bullet.

Default is false. A bullet is a fast-moving object that requires continuous collision detection.

◆ mask

uint16_t PhysicsCreationFlags::mask = default_collision_mask

Collision mask filtering.

Default is 0xFFFF | 0x0001. This value defines which categories this body collides with. E.g, 0x0002 | 0x0004 to collide with players and enemies.

◆ sensor

bool PhysicsCreationFlags::sensor {false}

Whether the body is a sensor.

Default is false. A sensor does not generate collision responses but can detect overlaps.


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