|
VR-Engage
2.2
|
The DtSceneObjectMimicUpdater allows one scene object to follow another's position and orientation with an optional offset. This updater is responsible for connecting to the parent scene object, tracking its position, and updating the child scene object accordingly. It also handles special cases like DiGuy character models and configures the child object's rendering properties.
Common use cases include:
#include <DtSceneObjectMimicUpdater.h>
Public Member Functions | |
| DtSceneObjectMimicUpdater (DtDe &de, DtUniqueID id) | |
| virtual | ~DtSceneObjectMimicUpdater () override |
| virtual void | update (DtTime tNow) override |
| virtual void | setParentSceneObject (DtUniqueID id) |
| virtual void | setModelOffset (const DtVector &offset) |
Protected Member Functions | |
| virtual void | checkModel () |
| virtual void | initModel (DtModelInstance *modelInstance) |
| virtual void | setupOsgNodes (DtOsgModelInstance *osgModelInstance) |
| virtual void | setupOsgNode (osg::Node *node) |
| virtual void | updatePosition (DtTime tNow) |
| virtual void | slot_parentSceneObjectToBeDeleted (const DtUniqueID &id) |
Protected Attributes | |
| DtSceneObject * | myParentSceneObject |
| DtModelInstance * | myModelInstance |
| DtVector | myModelOffset |
| double | myLinearSpeed |
| double | myYawSpeed |
| makVre::DtSceneObjectMimicUpdater::DtSceneObjectMimicUpdater | ( | DtDe & | de, |
| DtUniqueID | id ) |
Constructor for DtSceneObjectMimicUpdater.
Initializes the updater with default values (no parent object, null model instance, and zero speeds).
| de | Reference to the dynamic environment |
| id | Unique identifier for this updater |
References de().
|
overridevirtual |
Virtual destructor for DtSceneObjectMimicUpdater.
Clears the parent scene object reference to avoid dangling pointers.
|
overridevirtual |
Updates the scene object's position and orientation.
Called each frame to update the scene object's position and orientation based on the parent scene object. Performs model checking and position updating.
| tNow | Current simulation time |
|
virtual |
Sets the parent scene object to copy position from.
Establishes a connection to the specified scene object and sets up a signal/slot to handle parent object deletion. If a previous parent was set, disconnects from it.
| id | Unique identifier of the parent scene object |
|
virtual |
Sets the offset from the parent object.
Defines a local offset vector to apply when positioning this object relative to the parent. The offset is applied in the parent's local coordinate system.
| offset | Vector offset to apply (typically in meters) |
|
protectedvirtual |
Checks if the model instance has changed.
Verifies if the current scene object's model instance has changed since the last update. If it has, initializes the new model instance by calling initModel().
|
protectedvirtual |
Initializes a new model instance.
Sets up a new model instance, detecting if it's an OSG model instance and configuring it accordingly.
| modelInstance | Pointer to the model instance to initialize |
Reimplemented in makVre::DtFpsFirstPersonUpdater.
|
protectedvirtual |
Sets up OSG nodes for an OSG model instance.
Retrieves the root node from the OSG model instance and sets it up.
| osgModelInstance | Pointer to the OSG model instance to configure |
|
protectedvirtual |
Configures an OSG node.
Sets up rendering properties for the node, including:
| node | Pointer to the OSG node to configure |
Reimplemented in makVre::DtFpsFirstPersonUpdater.
|
protectedvirtual |
Updates the position and orientation.
Calculates and applies the position and orientation based on the parent object. Handles special cases like DiGuy character models.
| tNow | Current simulation time |
Reimplemented in makVre::DtFpsFirstPersonUpdater.
|
protectedvirtual |
Signal handler for parent scene object deletion.
Called when the parent scene object is about to be deleted. Clears the reference to avoid dangling pointers.
| id | The unique ID of the scene object being deleted |
|
protected |
Pointer to the parent scene object being mimicked.
This is the scene object whose position and orientation are being copied.
|
protected |
Pointer to the current model instance.
The model instance for the scene object being updated.
|
protected |
Offset vector to apply when positioning.
Local offset to apply from the parent object's position.
|
protected |
Smoothed linear speed.
Cached and smoothed linear speed value for animation purposes.
|
protected |
Smoothed yaw rotation speed.
Cached and smoothed yaw rotation speed value for animation purposes.