Hymn to Beauty
C++ 3D Engine
Component::RigidBody Class Reference

Component that allows interacting with other physics components. More...

#include <RigidBody.hpp>

Inheritance diagram for Component::RigidBody:
Component::SuperComponent

Public Member Functions

 RigidBody ()=default
 Constructor. More...
 
 ~RigidBody ()
 Destructor. More...
 
void Serialize (Json::Value &node, bool load) override
 Save or load component values to/from JSON. More...
 
bool IsKinematic () const
 
bool IsGhost () const
 
float GetFriction () const
 
float GetRollingFriction () const
 Get the rolling friction coefficient of the rigid body. More...
 
float GetSpinningFriction () const
 Get the spinning friction coefficient of the rigid body. More...
 
float GetRestitution () const
 Get the coefficient of restitution of the rigid body. More...
 
float GetLinearDamping () const
 Get the linear damping of the rigid body. More...
 
float GetAngularDamping () const
 Get the angular damping of the rigid body. More...
 
- Public Member Functions inherited from Component::SuperComponent
 SuperComponent ()
 Create new SuperComponent. More...
 
virtual ~SuperComponent ()
 Destructor. More...
 
void Kill ()
 Kill the component, will be removed at the end of the frame. More...
 
bool IsKilled () const
 Get whether component has been killed. More...
 

Friends

class ::PhysicsManager
 
class ::Physics::Trigger
 
class Shape
 

Additional Inherited Members

- Public Attributes inherited from Component::SuperComponent
Entityentity = nullptr
 Pointer to which entity this component corresponds. More...
 

Detailed Description

Component that allows interacting with other physics components.

Constructor & Destructor Documentation

◆ RigidBody()

Component::RigidBody::RigidBody ( )
default

Constructor.

◆ ~RigidBody()

Component::RigidBody::~RigidBody ( )

Destructor.

Member Function Documentation

◆ GetAngularDamping()

float Component::RigidBody::GetAngularDamping ( ) const

Get the angular damping of the rigid body.

Returns
Angular damping.

◆ GetFriction()

float Component::RigidBody::GetFriction ( ) const

Get the friction coefficient of the rigid body. Note that this does not necessarily match the real world as objects don't have one single value for friction.

Returns
Friction value.

◆ GetLinearDamping()

float Component::RigidBody::GetLinearDamping ( ) const

Get the linear damping of the rigid body.

Returns
Linear damping.

◆ GetRestitution()

float Component::RigidBody::GetRestitution ( ) const

Get the coefficient of restitution of the rigid body.

Returns
Coefficient of restitution.

◆ GetRollingFriction()

float Component::RigidBody::GetRollingFriction ( ) const

Get the rolling friction coefficient of the rigid body.

Returns
Rolling friction value.

◆ GetSpinningFriction()

float Component::RigidBody::GetSpinningFriction ( ) const

Get the spinning friction coefficient of the rigid body.

Returns
Spinning friction value.

◆ IsGhost()

bool Component::RigidBody::IsGhost ( ) const

Return a value indicating whether the rigid body is a ghost object, meaning that it disregards all collisions and only act as a collider for trigger purposes. Similar to a kinematic rigid body, movement is determined from the owning entity.

Returns
True if ghost, false otherwise.

◆ IsKinematic()

bool Component::RigidBody::IsKinematic ( ) const

Return a value indicating whether the rigid body is kinematic or dynamic. In the former case the transform is determined by that of its entity. In the latter case, Bullet calculates it.

Returns
True if kinematic, false if dynamic.

◆ Serialize()

void Component::RigidBody::Serialize ( Json::Value &  node,
bool  load 
)
overridevirtual

Save or load component values to/from JSON.

Parameters
nodeThe JSON node to save to or load from.
loadWhether to load (otherwise saves).

Implements Component::SuperComponent.

Friends And Related Function Documentation

◆ ::Physics::Trigger

friend class ::Physics::Trigger
friend

◆ ::PhysicsManager

friend class ::PhysicsManager
friend

◆ Shape

friend class Shape
friend

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