esp::physics::RigidObjectManager class

Class template defining responsibilities and functionality shared for managing all esp::physics::ManagedRigidObject wrappers.

Base classes

template<class T>
class RigidBaseManager<ManagedRigidObject>
Class template defining responsibilities and functionality shared for managing all esp::physics::AbstractManagedRigidBase wrappers.

Constructors, destructors, conversion operators

RigidObjectManager()

Public functions

auto addObjectByHandle(const std::string& attributesHandle, scene::SceneNode* attachmentNode = nullptr, const std::string& lightSetup = DEFAULT_LIGHTING_KEY) -> std::shared_ptr<ManagedRigidObject>
Instance a physical object from an object properties template in the esp::metadata::managers::ObjectAttributesManager. This method calls the physicsManager method with the same signature that queries for a DrawableGroup from Simulator.
auto addBulletObjectByHandle(const std::string& attributesHandle, scene::SceneNode* attachmentNode = nullptr, const std::string& lightSetup = DEFAULT_LIGHTING_KEY) -> std::shared_ptr<ManagedRigidObject>
Templated version of addObjectByHandle. Will cast result to appropriate dynamics library wrapper.
auto addObjectByID(int attributesID, scene::SceneNode* attachmentNode = nullptr, const std::string& lightSetup = DEFAULT_LIGHTING_KEY) -> std::shared_ptr<ManagedRigidObject>
Instance a physical object from an object properties template in the esp::metadata::managers::ObjectAttributesManager by template ID. This method calls the physicsManager method with the same signature that queries for a DrawableGroup from Simulator.
auto addBulletObjectByID(const int attributesID, scene::SceneNode* attachmentNode = nullptr, const std::string& lightSetup = DEFAULT_LIGHTING_KEY) -> std::shared_ptr<ManagedRigidObject>
Templated version of addObjectByID. Will cast result to appropriate dynamics library wrapper.
auto copyObjectByID(int objectID) -> std::shared_ptr<ManagedRigidObject>
Duplicate an existing RigidObject referenced by the given objectID .
auto copyBulletObjectByID(int objectID) -> std::shared_ptr<ManagedRigidObject>
Templated version of copyObjectByID. Will cast result to appropriate dynamics library wrapper.
auto removePhysObjectByID(int objectID, bool deleteObjectNode = true, bool deleteVisualNode = true) -> std::shared_ptr<ManagedRigidObject>
Overload of standard esp::core::managedContainers::ManagedContainer::removeObjectByID to allow for the retention of scene node or visual node of the underlying RigidObject after it and its wrapper's removal.
auto removePhysObjectByHandle(const std::string& objectHandle, bool deleteObjectNode = true, bool deleteVisualNode = true) -> std::shared_ptr<ManagedRigidObject>
Overload of standard esp::core::managedContainers::ManagedContainer::removeObjectByHandle to allow for the retention of scene node or visual node of the underlying RigidObject after it and its wrapper's removal.

Protected functions

void deleteObjectInternalFinalize(int objectID, const std::string& objectHandle) override
This method will remove rigid objects from physics manager. The wrapper has already been removed by the time this method is called (this is called from esp::core::managedContainers::ManagedContainerBase::deleteObjectInternal)

Function documentation

std::shared_ptr<ManagedRigidObject> esp::physics::RigidObjectManager::addObjectByHandle(const std::string& attributesHandle, scene::SceneNode* attachmentNode = nullptr, const std::string& lightSetup = DEFAULT_LIGHTING_KEY)

Instance a physical object from an object properties template in the esp::metadata::managers::ObjectAttributesManager. This method calls the physicsManager method with the same signature that queries for a DrawableGroup from Simulator.

Parameters
attributesHandle The handle of the object attributes used as the key to query esp::metadata::managers::ObjectAttributesManager.
attachmentNode If supplied, attach the new physical object to an existing SceneNode.
lightSetup
Returns a copy of the instanced object, or nullptr.

std::shared_ptr<ManagedRigidObject> esp::physics::RigidObjectManager::addBulletObjectByHandle(const std::string& attributesHandle, scene::SceneNode* attachmentNode = nullptr, const std::string& lightSetup = DEFAULT_LIGHTING_KEY)

Templated version of addObjectByHandle. Will cast result to appropriate dynamics library wrapper.

Parameters
attributesHandle The handle of the object attributes used as the key to query esp::metadata::managers::ObjectAttributesManager.
attachmentNode If supplied, attach the new physical object to an existing SceneNode.
lightSetup
Returns a copy of the instanced object, appropriately cast, or nullptr.

std::shared_ptr<ManagedRigidObject> esp::physics::RigidObjectManager::addObjectByID(int attributesID, scene::SceneNode* attachmentNode = nullptr, const std::string& lightSetup = DEFAULT_LIGHTING_KEY)

Instance a physical object from an object properties template in the esp::metadata::managers::ObjectAttributesManager by template ID. This method calls the physicsManager method with the same signature that queries for a DrawableGroup from Simulator.

Parameters
attributesID The ID of the object's template in esp::metadata::managers::ObjectAttributesManager
attachmentNode If supplied, attach the new physical object to an existing SceneNode.
lightSetup An optional custom lightsetup for the object.
Returns a copy of the instanced object, or nullptr.

std::shared_ptr<ManagedRigidObject> esp::physics::RigidObjectManager::addBulletObjectByID(const int attributesID, scene::SceneNode* attachmentNode = nullptr, const std::string& lightSetup = DEFAULT_LIGHTING_KEY)

Templated version of addObjectByID. Will cast result to appropriate dynamics library wrapper.

Parameters
attributesID The ID of the object's template in esp::metadata::managers::ObjectAttributesManager
attachmentNode If supplied, attach the new physical object to an existing SceneNode.
lightSetup
Returns a copy of the instanced object, appropriately cast, or nullptr.

std::shared_ptr<ManagedRigidObject> esp::physics::RigidObjectManager::copyObjectByID(int objectID)

Duplicate an existing RigidObject referenced by the given objectID .

Parameters
objectID The ID of the object to duplicate.
Returns A shared pointer to the newly instanced RigidObject 's wrapper .

std::shared_ptr<ManagedRigidObject> esp::physics::RigidObjectManager::copyBulletObjectByID(int objectID)

Templated version of copyObjectByID. Will cast result to appropriate dynamics library wrapper.

Returns a copy of the instanced object, appropriately cast, or nullptr.

std::shared_ptr<ManagedRigidObject> esp::physics::RigidObjectManager::removePhysObjectByID(int objectID, bool deleteObjectNode = true, bool deleteVisualNode = true)

Overload of standard esp::core::managedContainers::ManagedContainer::removeObjectByID to allow for the retention of scene node or visual node of the underlying RigidObject after it and its wrapper's removal.

Parameters
objectID The ID of the managed object to be deleted.
deleteObjectNode If true, deletes the object's scene node. Otherwise detaches the object from simulation.
deleteVisualNode If true, deletes the object's visual node. Otherwise detaches the object from simulation. Is not considered if deleteObjectNode==true.
Returns this always returns a nullptr, since a wrapper of a deleted object is unusable.

std::shared_ptr<ManagedRigidObject> esp::physics::RigidObjectManager::removePhysObjectByHandle(const std::string& objectHandle, bool deleteObjectNode = true, bool deleteVisualNode = true)

Overload of standard esp::core::managedContainers::ManagedContainer::removeObjectByHandle to allow for the retention of scene node or visual node of the underlying RigidObject after it and its wrapper's removal.

Parameters
objectHandle The handle of the managed object to be deleted.
deleteObjectNode If true, deletes the object's scene node. Otherwise detaches the object from simulation.
deleteVisualNode If true, deletes the object's visual node. Otherwise detaches the object from simulation. Is not considered if deleteObjectNode==true.
Returns this always returns a nullptr, since a wrapper of a deleted object is unusable.

void esp::physics::RigidObjectManager::deleteObjectInternalFinalize(int objectID, const std::string& objectHandle) override protected

This method will remove rigid objects from physics manager. The wrapper has already been removed by the time this method is called (this is called from esp::core::managedContainers::ManagedContainerBase::deleteObjectInternal)

Parameters
objectID the ID of the managed object to remove
objectHandle the string key of the managed object to remove.