esp::physics::RigidObject class

An AbstractFeature3D representing an individual rigid object instance attached to a SceneNode, updating its state through simulation. This may be a MotionType::STATIC scene collision geometry or an object of any MotionType which can interact with other members of a physical world. Must have a collision mesh. By default, a RigidObject is MotionType::KINEMATIC without an underlying simulator implementation. Derived classes can be used to introduce specific implementations of dynamics.

Base classes

class RigidBase

Derived classes

class BulletRigidObject
An individual rigid object instance implementing an interface with Bullet physics to enable dynamic objects. See btRigidBody for RigidObjectType::OBJECT.

Constructors, destructors, conversion operators

RigidObject(scene::SceneNode* rigidBodyNode, int objectId)
Constructor for a RigidObject.
~RigidObject() virtual
Virtual destructor for a RigidObject.

Public functions

auto initialize(const assets::ResourceManager& resMgr, const std::string& handle) -> bool override
Initializes the RigidObject that inherits from this class.
auto finalizeObject() -> bool override
Finalize the creation of RigidObject or RigidScene that inherits from this class.
auto getInitializationAttributes() const -> std::shared_ptr<assets::PhysicsObjectAttributes>
Get a copy of the template used to initialize this object.
auto setMotionType(MotionType mt) -> bool override
Set the MotionType of the object. If the object is ObjectType::SCENE it can only be MotionType::STATIC. If the object is ObjectType::OBJECT is can also be set to MotionType::KINEMATIC. Only if a dervied PhysicsManager implementing dynamics is in use can the object be set to MotionType::DYNAMIC.
auto getVelocityControl() -> VelocityControl::ptr
Retrieves a reference to the VelocityControl struct for this object.

Protected variables

VelocityControl::ptr velControl_
Convenience variable: specifies a constant control velocity (linear | angular) applied to the rigid body before each step.

Private functions

auto initialization_LibSpecific(const assets::ResourceManager& resMgr) -> bool override
Finalize the initialization of this RigidScene geometry. This is overridden by inheriting class specific to certain physics libraries. Necessary to support kinematic objects without any dynamics support.
auto finalizeObject_LibSpecific() -> bool override
any physics-lib-specific finalization code that needs to be run after RigidObject is created. Overridden by inheriting class specific to certain physics libraries. Necessary to support kinematic objects without any dynamics support.

Function documentation

esp::physics::RigidObject::RigidObject(scene::SceneNode* rigidBodyNode, int objectId)

Constructor for a RigidObject.

Parameters
rigidBodyNode The scene::SceneNode this feature will be attached to.
objectId

bool esp::physics::RigidObject::initialize(const assets::ResourceManager& resMgr, const std::string& handle) override

Initializes the RigidObject that inherits from this class.

Parameters
resMgr a reference to ResourceManager object
handle The handle for the template structure defining relevant phyiscal parameters for this object
Returns true if initialized successfully, false otherwise.

bool esp::physics::RigidObject::finalizeObject() override

Finalize the creation of RigidObject or RigidScene that inherits from this class.

Returns whether successful finalization.

std::shared_ptr<assets::PhysicsObjectAttributes> esp::physics::RigidObject::getInitializationAttributes() const

Get a copy of the template used to initialize this object.

Returns A copy of the PhysicsObjectAttributes template used to create this object.

bool esp::physics::RigidObject::setMotionType(MotionType mt) override

Set the MotionType of the object. If the object is ObjectType::SCENE it can only be MotionType::STATIC. If the object is ObjectType::OBJECT is can also be set to MotionType::KINEMATIC. Only if a dervied PhysicsManager implementing dynamics is in use can the object be set to MotionType::DYNAMIC.

Parameters
mt The desirved MotionType.
Returns true if successfully set, false otherwise.

bool esp::physics::RigidObject::initialization_LibSpecific(const assets::ResourceManager& resMgr) override private

Finalize the initialization of this RigidScene geometry. This is overridden by inheriting class specific to certain physics libraries. Necessary to support kinematic objects without any dynamics support.

Parameters
resMgr Reference to resource manager, to access relevant components pertaining to the scene object
Returns true if initialized successfully, false otherwise.

bool esp::physics::RigidObject::finalizeObject_LibSpecific() override private

any physics-lib-specific finalization code that needs to be run after RigidObject is created. Overridden by inheriting class specific to certain physics libraries. Necessary to support kinematic objects without any dynamics support.

Returns whether successful finalization.