|
Fireworks Engine
v2.0
Lightweight Sandbox Game Engine using OpenGL for additional Customisation and Quick Prototyping
|
RigidBody 2D Physics component to simulate real time physics. More...
#include <rigidbody2d.h>


Public Member Functions | |
| RigidBody2D (float density, float friction, RigidBodyType bodytype, b2World &world=World) | |
| Creates the rigid body. More... | |
| ~RigidBody2D () | |
| glm::vec3 | GetPositionInMeters () |
| Gets the position of the rigid body in meters (M.K.S system) More... | |
| glm::vec3 | GetPositionInPixels () |
| Gets the position of the rigid body in pixels. More... | |
| float | GetRotation () |
| Gets the rotation of the rigid body in radians. More... | |
| void | AddForce (glm::vec2 direction, float force) |
| Applies force to the rigid body. More... | |
| void | SetVelocity (glm::vec2 velocity) |
| Sets the velocity of the rigid body. More... | |
| void | SetPosition (const glm::vec3 &position) |
| Sets the position of the rigid body. More... | |
| void | SetSize (glm::vec2 &size) |
| Sets the size of the rigid body. More... | |
| void | GenerateRigidBody (glm::vec3 pos, glm::vec2 dim) |
| Generates a plane rigid body using the position and dimensions. More... | |
| b2Body * | GetBody () |
| Gets the box2D body of the rigid body. More... | |
Public Attributes | |
| RigidBodyType | bodyType |
| Denotes whether the RigidBody2D is dynamic, static or kinematic. More... | |
| float | density |
| The density of the rigid body. More... | |
| float | friction |
| The friction of the rigid body surface. More... | |
| float | resitution |
| The bounciness of the rigid body. More... | |
| float | gravityScale |
| The effect of gravity on the rigid body. More... | |
| bool | fixedRotation |
| Whether or not to clamp the rigid bodys rotation. More... | |
Public Attributes inherited from fireworks::components::Component | |
| ComponentType | componentType |
| Basic information about the type of the component. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from fireworks::components::Component | |
| Component (const std::string &componentName, unsigned int componentID) | |
| Creates the component. More... | |
| virtual void | Dummy () |
| A Dummy method to make the class polymorphic. More... | |
RigidBody 2D Physics component to simulate real time physics.
| fireworks::physics::RigidBody2D::RigidBody2D | ( | float | density, |
| float | friction, | ||
| RigidBodyType | bodytype, | ||
| b2World & | world = World |
||
| ) |
Creates the rigid body.
| density | The density of the body |
| friction | The friction of the rigid body surface |
| bodytype | The type of rigid body |
| fireworks::physics::RigidBody2D::~RigidBody2D | ( | ) |
| void fireworks::physics::RigidBody2D::AddForce | ( | glm::vec2 | direction, |
| float | force | ||
| ) |
Applies force to the rigid body.
| direction | The direction in which to apply force to the rigid body |
| force | The magnitude of the force to apply |
| void fireworks::physics::RigidBody2D::GenerateRigidBody | ( | glm::vec3 | pos, |
| glm::vec2 | dim | ||
| ) |
Generates a plane rigid body using the position and dimensions.
|
inline |
Gets the box2D body of the rigid body.
| glm::vec3 fireworks::physics::RigidBody2D::GetPositionInMeters | ( | ) |
Gets the position of the rigid body in meters (M.K.S system)
| glm::vec3 fireworks::physics::RigidBody2D::GetPositionInPixels | ( | ) |
Gets the position of the rigid body in pixels.
| float fireworks::physics::RigidBody2D::GetRotation | ( | ) |
Gets the rotation of the rigid body in radians.
| void fireworks::physics::RigidBody2D::SetPosition | ( | const glm::vec3 & | position | ) |
Sets the position of the rigid body.
| void fireworks::physics::RigidBody2D::SetSize | ( | glm::vec2 & | size | ) |
Sets the size of the rigid body.
| void fireworks::physics::RigidBody2D::SetVelocity | ( | glm::vec2 | velocity | ) |
Sets the velocity of the rigid body.
| velocity | A 2D velocity vector |
| RigidBodyType fireworks::physics::RigidBody2D::bodyType |
Denotes whether the RigidBody2D is dynamic, static or kinematic.
| float fireworks::physics::RigidBody2D::density |
The density of the rigid body.
| bool fireworks::physics::RigidBody2D::fixedRotation |
Whether or not to clamp the rigid bodys rotation.
| float fireworks::physics::RigidBody2D::friction |
The friction of the rigid body surface.
| float fireworks::physics::RigidBody2D::gravityScale |
The effect of gravity on the rigid body.
| float fireworks::physics::RigidBody2D::resitution |
The bounciness of the rigid body.