VR-Engage  2.2
Loading...
Searching...
No Matches
vreDieWhenHitActuator.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreDieWhenHitActuator.h
7//! \ingroup vreVrfmodel
8//! \brief Actuator for making entities die when hit or run over
9//!
10//! This file defines the DtVreDieWhenHitActuator class which causes entities
11//! to be marked as destroyed when they are hit by weapons or run over by vehicles.
12//! It extends the base die-when-hit functionality with VRE-specific behaviors.
13
14#pragma once
15
16#include "vreVrfmodel/export.h"
17#include <vrfmodel/dieWhenHitActuator.h>
18#include "vreVrfModel/vreSimComponent.h"
19
20namespace makVre
21{
22//! \brief Type identifier for the VRE die-when-hit actuator component
23const char DtVreDieWhenHitActuatorType[] = "vre-die-when-hit-actuator";
24
25//! \brief Actuator that causes entities to die when hit or run over
26//!
27//! DtVreDieWhenHitActuator extends the base die-when-hit actuator with VRE-specific
28//! functionality. It monitors for collision events and weapon hits, changing the entity
29//! to a destroyed state when appropriate. This actuator specifically checks for
30//! vehicles running over the entity and handles those collisions as destruction events.
31class VREVRFMODEL_DLL DtVreDieWhenHitActuator : public DtVreSimComponent<DtDieWhenHitActuator>
32{
33public:
34 //! \brief Constructor
35 //! \param name The name of this component
36 //! \param object The local object that owns this component
37 //! \param simManager The simulation services manager
38 //! \param compDescriptor Component descriptor with configuration parameters
39 //! \param parentRegistry Optional parent registry for reader/writer functionality
40 //!
41 //! Creates a new die-when-hit actuator component with the specified parameters.
42 DtVreDieWhenHitActuator(const DtString& name, DtLocalObject* object, DtSimulationServices* simManager,
43 DtComponentDescriptor* compDescriptor, DtReaderWriterRegistry* parentRegistry = 0);
44
45 //! \brief Virtual destructor
46 //!
47 //! Cleans up resources used by the die-when-hit actuator component.
48 virtual ~DtVreDieWhenHitActuator() override;
49
50 //! \brief Gets the type identifier for this component
51 //! \return String identifying the component type (DtVreDieWhenHitActuatorType)
52 //!
53 //! Implements the DtSimComponent::type() method to return the
54 //! type identifier for this component.
55 virtual const char* type() const override;
56
57 //! \brief Updates the actuator state each simulation frame
58 //!
59 //! Checks for collision events with vehicles and other destruction conditions.
60 //! If hit by a weapon or run over by a vehicle, changes the entity to the
61 //! destroyed state. Updates kinematic state and copies it to the state repository.
62 virtual void tick() override;
63
64public:
65 //! \brief Factory method to create a new instance of this component
66 //! \param name The name for the new component
67 //! \param object The local object that will own this component
68 //! \param simManager The simulation services manager
69 //! \param compDescriptor Optional component descriptor
70 //! \param parentRegistry Optional parent registry for reader/writer functionality
71 //! \return Pointer to the newly created component
72 //!
73 //! Static factory method used by the component creation system to instantiate
74 //! new instances of this component type.
75 static DtSimComponent* creator(const DtString& name, DtLocalObject* object, DtSimulationServices* simManager,
76 DtComponentDescriptor* compDescriptor, DtReaderWriterRegistry* parentRegistry);
77};
78
79} // namespace makVre
DtVreDieWhenHitActuator(const DtString &name, DtLocalObject *object, DtSimulationServices *simManager, DtComponentDescriptor *compDescriptor, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
virtual const char * type() const override
Gets the type identifier for this component.
virtual ~DtVreDieWhenHitActuator() override
Virtual destructor.
virtual void tick() override
Updates the actuator state each simulation frame.
static DtSimComponent * creator(const DtString &name, DtLocalObject *object, DtSimulationServices *simManager, DtComponentDescriptor *compDescriptor, DtReaderWriterRegistry *parentRegistry)
Factory method to create a new instance of this component.
DtVreSimComponent(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Definition vreSimComponent.h:54
Defines export macros for the vreVrfmodel library.
#define VREVRFMODEL_DLL
Definition export.h:22
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char DtVreDieWhenHitActuatorType[]
Type identifier for the VRE die-when-hit actuator component.
Definition vreDieWhenHitActuator.h:23