IEntity

#include

Public Types

enum EEntityLoadFlags { EF_AUTO_PHYSICALIZE = 0x0001, EF_NO_STREAMING = 0x0002 }
enum EAttachmentFlags {
ATTACHMENT_KEEP_TRANSFORMATION = BIT(0), ATTACHMENT_GEOMCACHENODE = BIT(1), ATTACHMENT_CHARACTERBONE = BIT(2), ATTACHMENT_LOCAL_SIM = BIT(3),
ATTACHMENT_SUPPRESS_UPDATE = BIT(4), ATTACHMENT_COUNT = 5
}
using AttachmentFlagsMask = CEnumFlags< EAttachmentFlags >
using AttachmentFlagsType = uint32
typedef std::function< void(IEntityComponent *)> ComponentsVisitor

Public Member Functions

virtual EntityId GetId () const =0
virtual const EntityGUID & GetGuid () const =0
virtual IEntityClass * GetClass () const =0
virtual CRY_DEPRECATED_ENTTIY_ARCHETYPE IEntityArchetype * GetArchetype () const =0
virtual void SetFlags (uint32 flags)=0
virtual uint32 GetFlags () const =0
Gets current entity flags.
virtual void AddFlags (uint32 flagsToAdd)=0
virtual void ClearFlags (uint32 flagsToClear)=0
virtual bool CheckFlags (uint32 flagsToCheck) const =0
virtual void SetFlagsExtended (uint32 flags)=0
virtual uint32 GetFlagsExtended () const =0
Gets current entity EEntityFlagsExtended flags.
virtual bool IsGarbage () const =0
virtual uint8 GetComponentChangeState () const =0
virtual void SetName (const char *sName)=0
virtual const char * GetName () const =0
virtual string GetEntityTextDescription () const =0
Returns textual description of entity for logging.
virtual void SerializeXML (XmlNodeRef &entityNode, bool bLoading, bool bIncludeScriptProxy=true, bool bExcludeSchematycProperties=false)=0
Serializes entity parameters to/from XML.
virtual bool IsLoadedFromLevelFile () const =0
virtual void AttachChild (IEntity *pChildEntity, const SChildAttachParams &attachParams=SChildAttachParams())=0
virtual void DetachAll (AttachmentFlagsType attachmentFlags=0)=0
Detaches all the child entities attached to this entity.
virtual void DetachThis (AttachmentFlagsType attachmentFlags=0, EntityTransformationFlagsType transformReasons=0)=0
Detach this entity from the parent entity (assumes that this entity is the child entity).
virtual int GetChildCount () const =0
Retrieves the number of attached child entities.
virtual IEntity * GetChild (int nIndex) const =0
virtual IEntity * GetParent () const =0
virtual IEntity * GetLocalSimParent () const =0
virtual Matrix34 GetParentAttachPointWorldTM () const =0
virtual bool IsParentAttachmentValid () const =0
virtual void SetWorldTM (const Matrix34 &tm, EntityTransformationFlagsMask transformReasons=EntityTransformationFlagsMask())=0
virtual void SetLocalTM (const Matrix34 &tm, EntityTransformationFlagsMask transformReasons=EntityTransformationFlagsMask())=0
virtual const Matrix34 & GetWorldTM () const =0
virtual Matrix34 GetLocalTM () const =0
virtual void GetWorldBounds (AABB &bbox) const =0
virtual void GetLocalBounds (AABB &bbox) const =0
virtual void SetLocalBounds (const AABB &bounds, bool bDoNotRecalculate)=0
virtual void InvalidateLocalBounds ()=0
Invalidates local or world space bounding box.
virtual void SetPos (const Vec3 &vPos, EntityTransformationFlagsMask transformReasons=EntityTransformationFlagsMask(), bool bRecalcPhyBounds=false, bool bForce=false)=0
Set the entity local space position.
virtual const Vec3 & GetPos () const =0
Retrieve the entity local space position.
virtual void SetRotation (const Quat &qRotation, EntityTransformationFlagsMask transformReasons=EntityTransformationFlagsMask())=0
Sets the entity local space rotation quaternion.
virtual const Quat & GetRotation () const =0
Retrieves the entity local space rotation quaternion.
virtual void SetScale (const Vec3 &vScale, EntityTransformationFlagsMask transformReasons=EntityTransformationFlagsMask())=0
Sets the entity local space scale.
virtual const Vec3 & GetScale () const =0
Retrieves the entity local space scale.
virtual void SetPosRotScale (const Vec3 &vPos, const Quat &qRotation, const Vec3 &vScale, EntityTransformationFlagsMask transformReasons=EntityTransformationFlagsMask())=0
Sets the entity position,rotation and scale at once.
virtual Vec3 GetWorldPos () const =0
Helper function to retrieve world space entity position.
virtual Ang3 GetWorldAngles () const =0
Helper function to retrieve world space entity orientation angles.
virtual Quat GetWorldRotation () const =0
Helper function to retrieve world space entity orientation quaternion.
virtual Vec3 GetWorldScale () const =0
Helper function to retrieve world space entity scale.
virtual void UpdateComponentEventMask (const IEntityComponent *pComponent)=0
virtual bool IsActivatedForUpdates () const =0
Checks whether the entity is set to be updated this / next frame.
virtual void Serialize (TSerialize serializer, int nFlags=0)=0
virtual bool SendEvent (const SEntityEvent &event)=0
virtual void AddEventListener (EEntityEvent event, IEntityEventListener *pListener)=0
Adds a listener that can receive the specified event from this entity.
virtual void RemoveEventListener (EEntityEvent event, IEntityEventListener *pListener)=0
Removes an existing event listener from the entity.
virtual int SetTimer (int nTimerId, int nMilliSeconds)=0
virtual void KillTimer (int nTimerId)=0
virtual void Hide (bool bHide, EEntityHideFlags hideFlags=ENTITY_HIDE_NO_FLAG)=0
virtual bool IsHidden () const =0
Checks if the entity is hidden.
virtual void Invisible (bool bInvisible)=0
virtual bool IsInvisible () const =0
Checks if the entity is invisible.
virtual const IAIObject * GetAI () const =0
virtual IAIObject * GetAI ()=0
virtual bool HasAI () const =0
virtual tAIObjectID GetAIObjectID () const =0
virtual void SetAIObjectID (tAIObjectID id)=0
IEntity * GetRenderInterface ()
Retrieve access to the rendering functionality of the Entity.
virtual ISerializableInfoPtr GetSerializableNetworkSpawnInfo () const =0
virtual IEntityComponent * GetProxy (EEntityProxy proxy) const =0
virtual IEntityComponent * CreateProxy (EEntityProxy proxy)=0
virtual IEntityComponent * CreateComponentByInterfaceID (const CryInterfaceID &interfaceId, IEntityComponent::SInitParams *pInitParams=nullptr)=0
virtual bool AddComponent (std::shared_ptr< IEntityComponent > pComponent, IEntityComponent::SInitParams *pInitParams=nullptr)=0
virtual void RemoveComponent (IEntityComponent *pComponent)=0
virtual void RemoveAllComponents ()=0
Removes and shut downs all components that entity contains.
virtual void ReplaceComponent (IEntityComponent *pExistingComponent, std::shared_ptr< IEntityComponent > pNewComponent)=0
virtual IEntityComponent * GetComponentByTypeId (const CryInterfaceID &interfaceID) const =0
virtual void GetComponentsByTypeId (const CryInterfaceID &interfaceID, DynArray< IEntityComponent *> &components) const =0
virtual IEntityComponent * GetComponentByGUID (const CryGUID &guid) const =0
virtual void QueryComponentsByInterfaceID (const CryInterfaceID &interfaceID, DynArray< IEntityComponent *> &components) const =0
Queries an array of entity components implementing the specified component interface.
virtual IEntityComponent * QueryComponentByInterfaceID (const CryInterfaceID &interfaceID) const =0
Queries an entity component implementing the specified component interface.
template
ComponentType * CreateComponent ()
template
ComponentType * GetOrCreateComponent (bool bCheckHierarchy=true)
template
ComponentType * GetComponent (bool bCheckHierarchy=true) const
template
void GetAllComponents (DynArray< ComponentType *> &components, bool bCheckHierarchy=true) const
template
ComponentType * CreateComponentClass (TArgs &&... args)
Create a new initialized component using a new operator of the class type.
template
ComponentType * GetOrCreateComponentClass (TArgs &&... args)
Get existing or Create a new initialized component using the new operator of the class type, typeid of the component is null guid.
template
void RemoveComponent (bool checkHierarchy=true)
template
void RemoveAllComponents (bool checkHierarchy=true)
virtual void GetComponents (DynArray< IEntityComponent *> &components) const =0
Retrieve array of entity components.
virtual uint32 GetComponentsCount () const =0
Retrieve nu number of components in the entity.
virtual void VisitComponents (const ComponentsVisitor &visitor)=0
virtual void Physicalize (SEntityPhysicalizeParams &params)=0
virtual void EnablePhysics (bool enable)=0
Enable/Disable physics by flag.
virtual bool IsPhysicsEnabled () const =0
Is physical simulation enabled?
virtual void AssignPhysicalEntity (IPhysicalEntity *pPhysEntity, int nSlot=-1)=0
virtual IPhysicalEntity * GetPhysics () const =0
IPhysicalEntity * GetPhysicalEntity () const
virtual int PhysicalizeSlot (int slot, SEntityPhysicalizeParams &params)=0
virtual void UnphysicalizeSlot (int slot)=0
virtual void UpdateSlotPhysics (int slot)=0
virtual void SetPhysicsState (XmlNodeRef &physicsState)=0
virtual void GetPhysicsWorldBounds (AABB &bounds) const =0
virtual void AddImpulse (int ipart, const Vec3 &pos, const Vec3 &impulse, bool bPos, float fAuxScale, float fPushScale=1.0f)=0
Add impulse to physical entity.
virtual bool PhysicalizeFoliage (int iSlot)=0
Physicalizes the foliage of StatObj in slot iSlot.
virtual void DephysicalizeFoliage (int iSlot)=0
Dephysicalizes the foliage in slot iSlot.
virtual int GetPhysicalEntityPartId0 (int islot=0)=0
retrieve starting partid for a given slot.
virtual void PhysicsNetSerializeEnable (bool enable)=0
Enable/disable network serialization of the physics aspect.
virtual void PhysicsNetSerializeTyped (TSerialize &ser, int type, int flags)=0
virtual void PhysicsNetSerialize (TSerialize &ser)=0
virtual void SetMaterial (IMaterial *pMaterial)=0
virtual IMaterial * GetMaterial ()=0
virtual bool IsSlotValid (int nIndex) const =0
virtual int AllocateSlot ()=0
Allocates index for an entity slot.
virtual void FreeSlot (int nIndex)=0
Frees slot at specified index.
virtual int GetSlotCount () const =0
Gets number of allocated object slots in the entity.
virtual void ClearSlots ()=0
Removes all object slots from the entity.
virtual bool GetSlotInfo (int nIndex, SEntitySlotInfo &slotInfo) const =0
virtual Matrix34 GetSlotWorldTM (int nSlot) const =0
virtual Matrix34 GetSlotLocalTM (int nSlot, bool bRelativeToParent) const =0
virtual void SetSlotLocalTM (int nSlot, const Matrix34 &localTM, EntityTransformationFlagsMask transformReasons=EntityTransformationFlagsMask())=0
Sets local transformation matrix of the object slot.
virtual void SetSlotCameraSpacePos (int nSlot, const Vec3 &cameraSpacePos)=0
Sets camera space position of the object slot.
virtual void GetSlotCameraSpacePos (int nSlot, Vec3 &cameraSpacePos) const =0
Gets camera space position of the object slot.
virtual bool SetParentSlot (int nParentIndex, int nChildIndex)=0
virtual void UpdateSlotForComponent (IEntityComponent *pComponent)=0
Prepare and update an entity slot to be used with component.
virtual void SetSlotMaterial (int nSlot, IMaterial *pMaterial)=0
virtual IMaterial * GetSlotMaterial (int nSlot) const =0
virtual IMaterial * GetRenderMaterial (int nSlot=-1) const =0
virtual void SetSlotFlags (int nSlot, uint32 nFlags)=0
virtual uint32 GetSlotFlags (int nSlot) const =0
virtual void SetSubObjHideMask (int nSlot, hidemask nSubObjHideMask)=0
virtual hidemask GetSubObjHideMask (int nSlot) const =0
virtual bool ShouldUpdateCharacter (int nSlot) const =0
virtual ICharacterInstance * GetCharacter (int nSlot)=0
virtual int SetCharacter (ICharacterInstance *pCharacter, int nSlot, bool bUpdatePhysics=true)=0
virtual IStatObj * GetStatObj (int nSlot)=0
virtual IParticleEmitter * GetParticleEmitter (int nSlot)=0
virtual IGeomCacheRenderNode * GetGeomCacheRenderNode (int nSlot)=0
virtual void MoveSlot (IEntity *targetIEnt, int nSlot)=0
virtual int SetStatObj (IStatObj *pStatObj, int nSlot, bool bUpdatePhysics, float mass=-1.0f)=0
virtual int LoadGeometry (int nSlot, const char *sFilename, const char *sGeomName=NULL, int nLoadFlags=0)=0
virtual int LoadCharacter (int nSlot, const char *sFilename, int nLoadFlags=0)=0
virtual int LoadGeomCache (int nSlot, const char *sFilename)=0
virtual int SetSlotRenderNode (int nSlot, IRenderNode *pRenderNode)=0
Assigns a 3DEngine render node to the Entity Slot.
virtual IRenderNode * GetSlotRenderNode (int nSlot)=0
Returns a 3DEngine render node assigned to an Entity Slot.
virtual INetEntity * GetNetEntity ()=0
virtual INetEntity * AssignNetEntityLegacy (INetEntity *ptr)=0
virtual int LoadParticleEmitter (int nSlot, IParticleEffect *pEffect, SpawnParams const *params=NULL, bool bPrime=false, bool bSerialize=false)=0
virtual int SetParticleEmitter (int nSlot, IParticleEmitter *pEmitter, bool bSerialize=false)=0
virtual int LoadLight (int nSlot, SRenderLight *pLight)=0
virtual int LoadFogVolume (int nSlot, const SFogVolumeProperties &properties)=0
virtual void InvalidateTM (EntityTransformationFlagsMask transformReasons=EntityTransformationFlagsMask(), bool bRecalcPhyBounds=false)=0
Invalidates the entity's and all its children's transformation matrices!
virtual CRY_DEPRECATED_ENTTIY_LUA IScriptTable * GetScriptTable () const =0
Easy Script table access.
virtual IRenderNode * GetRenderNode (int nSlot=-1) const =0
virtual bool IsRendered () const =0
virtual void PreviewRender (SEntityPreviewContext &context)=0
virtual void SetRenderNodeParams (const IEntity::SRenderNodeParams &params)=0
Sets common parameters that are applied on all render nodes for this render proxy.
virtual IEntity::SRenderNodeParams GetRenderNodeParams () const =0
virtual IEntityLink * GetEntityLinks ()=0
Entity links. More...
virtual IEntityLink * AddEntityLink (const char *sLinkName, EntityId entityId, EntityGUID entityGuid)=0
virtual void RenameEntityLink (IEntityLink *pLink, const char *sNewLinkName)=0
virtual void RemoveEntityLink (IEntityLink *pLink)=0
virtual void RemoveAllEntityLinks ()=0
virtual IEntity * UnmapAttachedChild (int &partId)=0
virtual void GetMemoryUsage (ICrySizer *pSizer) const =0
virtual void IncKeepAliveCounter ()=0
virtual void DecKeepAliveCounter ()=0
virtual void ResetKeepAliveCounter ()=0
virtual bool IsKeptAlive () const =0
virtual bool HandleVariableChange (const char *szVarName, const void *pVarData)=0
virtual void OnRenderNodeVisibilityChange (bool bBecomeVisible)=0
Called by the 3DEngine when RenderNode created by this entity start or stop being rendered.
virtual float GetLastSeenTime () const =0
virtual uint32 GetEditorObjectID () const =0
virtual void GetEditorObjectInfo (bool &bSelected, bool &bHighlighted) const =0
virtual void SetEditorObjectInfo (bool bSelected, bool bHighlighted)=0
virtual EEntitySimulationMode GetSimulationMode () const =0
Retrieve current simulation mode of the Entity.
virtual Schematyc::IObject * GetSchematycObject () const =0
Schematyc Object associated with this entity.
virtual void OnSchematycObjectDestroyed ()=0
void SetViewDistRatio (int nViewDistRatio)
Set the viewDistRatio on the render node.
void SetLodRatio (int nLodRatio)
Sets the LodRatio on the render node.
void SetAdditionalRenderNodeFlags (uint64 flags, bool bEnable)
void SetOpacity (float fAmount)
float GetOpacity () const
Vec3 GetForwardDir () const
Returns the forward facing direction of the entity.
Vec3 GetRightDir () const
Returns the right facing direction of the entity.
Vec3 GetUpDir () const
Returns the up facing direction of the entity.

Static Public Member Functions

static CryGUID GetEntityScopeGUID ()
This is a GUID of the Schematyc environment scope where all entity components must be registered under to be found in UI.

Static Public Attributes

static constexpr int CREATE_NEW_UNIQUE_TIMER_ID = -666
static constexpr int KILL_ALL_TIMER = -1

Detailed Description

Entities represent dynamic objects that can manipulate themselves or the scene they reside in during runtime. Examples include light sources, physicalized objects (such as bullets) and players. Entities themselves can not contain custom logic, instead they can contain Components (see IEntityComponent).

Member Typedef Documentation

◆ ComponentsVisitor

typedef std::functionIEntityComponent*)> IEntity::ComponentsVisitor

Callback used for visiting components

See also
IEntity::VisitComponents method

Member Enumeration Documentation

◆ EAttachmentFlags

Enumerator
ATTACHMENT_KEEP_TRANSFORMATION

Keeps world transformation of entity when attaching or detaching it.

ATTACHMENT_GEOMCACHENODE

Attach to geom cache node.

ATTACHMENT_CHARACTERBONE

Attached to character bone.

ATTACHMENT_LOCAL_SIM

Simulated inside the parent by the physics.

ATTACHMENT_SUPPRESS_UPDATE

Suppresses attachment event and matrix update.

Member Function Documentation

◆ AddComponent()

virtual bool IEntity::AddComponent ( std::shared_ptr< IEntityComponent > pComponent,
IEntityComponent::SInitParams * pInitParams = nullptr
)
pure virtual

Adds an already created component to the entity

Parameters
pComponentA shared pointer to the component we want to add, can not be null!
pInitParamsOptional initialization parameters to determine the initial state of the component
Returns
True if the component was added, otherwise false.

◆ AddFlags()

virtual void IEntity::AddFlags ( uint32 flagsToAdd)
pure virtual

Adds flag/s to the current set of entity flags (logical OR).

Parameters
flagsToAddCombination of bit flags to add.

◆ AssignNetEntityLegacy()

virtual INetEntity* IEntity::AssignNetEntityLegacy ( INetEntity * ptr)
pure virtual

Do not use. Provides a way for CGameObject to replace NetEntity with itself.

◆ AssignPhysicalEntity()

virtual void IEntity::AssignPhysicalEntity ( IPhysicalEntity * pPhysEntity,
int nSlot = -1
)
pure virtual

Assign a pre-created physical entity to this proxy.

Parameters
pPhysEntityThe pre-created physical entity.
nSlotSlot Index to which the new position will be taken from.

◆ AttachChild()

virtual void IEntity::AttachChild ( IEntity * pChildEntity,
const SChildAttachParams & attachParams = SChildAttachParams()
)
pure virtual

Attaches the child entity to this entity. The child entity will inherit all the transformation of the parent entity.

Parameters
pChildEntityChild entity to attach.
attachParamsAttachment parameters.

◆ CheckFlags()

virtual bool IEntity::CheckFlags ( uint32 flagsToCheck) const
pure virtual

Checks if the specified entity flag is set.

Parameters
flagsToCheckCombination of bit flags to check.

◆ ClearFlags()

virtual void IEntity::ClearFlags ( uint32 flagsToClear)
pure virtual

Removes flag/s from the current set of entity flags (logical AND NOT).

Parameters
flagsToClearCombination of bit flags to remove.

◆ CreateComponent()

template
ComponentType* IEntity::CreateComponent ( )
inline

Creates a new entity component of type ComponentType from a registered factory and adds it to the entity. ComponentType must be a valid IEntityComponent implementation.

Returns
A pointer to the newly created component, otherwise nullptr (and likely an assertion).

◆ CreateComponentByInterfaceID()

virtual IEntityComponent* IEntity::CreateComponentByInterfaceID ( const CryInterfaceID & interfaceId,
IEntityComponent::SInitParams * pInitParams = nullptr
)
pure virtual

Queries an entity component type by interface, and then creates the component inside this entity

Parameters
interfaceIdThe GUID of the component we want to add
pInitParamsOptional initialization parameters to determine the initial state of the component
Returns
The newly created entity component pointer (owned by the entity), or null if creation failed.

◆ CreateProxy()

virtual IEntityComponent* IEntity::CreateProxy ( EEntityProxy proxy)
pure virtual

Creates a specified proxy in the entity.

Parameters
proxyProxy interface identifier.
Returns
Valid pointer to the created entity proxy object, or NULL if creation failed.

◆ GetAllComponents()

template
void IEntity::GetAllComponents ( DynArray< ComponentType *> & components,
bool bCheckHierarchy = true
) const
inline

Helper template function to simplify finding all components implementing the specified component type

Parameters
componentsDynArray into which any found components will be stored
bCheckHierarchyWhether or not we should traverse the inheritance hierarchy for all components, otherwise performs a (much faster) equality check to see if the implementation is ComponentType

◆ GetArchetype()

virtual CRY_DEPRECATED_ENTTIY_ARCHETYPE IEntityArchetype* IEntity::GetArchetype ( ) const
pure virtual

Retrieves the entity archetype. Entity archetype contain definition for entity script properties.

Returns
Pointer to the entity archetype interface.

◆ GetCharacter()

virtual ICharacterInstance* IEntity::GetCharacter ( int nSlot)
pure virtual

Fast method to get the character at the specified slot.

Parameters
nSlotIndex of the slot.
Returns
Character pointer or NULL if character with this slot does not exist.

◆ GetChild()

virtual IEntity* IEntity::GetChild ( int nIndex) const
pure virtual

Retrieves the attached child entity by index.

Parameters
nIndexIndex of the child entity, must be 0 <= nIndex < GetChildCount().
Returns
Pointer to the child entity interface.

◆ GetClass()

virtual IEntityClass* IEntity::GetClass ( ) const
pure virtual

Retrieves the entity class pointer. Entity class defines entity type, what script it will use, etc...

Returns
Pointer to the entity class interface.

◆ GetComponent()

template
ComponentType* IEntity::GetComponent ( bool bCheckHierarchy = true) const
inline

Helper template function to simplify finding the first component implementing the specified component type This will traverse the inheritance tree, and is therefore slower than GetComponentByImplementation which simply does an equality check. ex: auto pScriptProxy = pEntity->GetComponent();

Parameters
bCheckHierarchyWhether or not we should traverse the inheritance hierarchy for all components, otherwise performs a (much faster) equality check to see if the implementation is ComponentType

◆ GetComponentByGUID()

virtual IEntityComponent* IEntity::GetComponentByGUID ( const CryGUID & guid) const
pure virtual

Return component with the unique GUID.

Parameters
guidIdentifier for the component.

◆ GetComponentByTypeId()

virtual IEntityComponent* IEntity::GetComponentByTypeId ( const CryInterfaceID & interfaceID) const
pure virtual

Return first component of the entity with the specified class ID.

Parameters
interfaceIDIdentifier for the component implementation.

◆ GetComponentChangeState()

virtual uint8 IEntity::GetComponentChangeState ( ) const
pure virtual

Returns a number which is incremeting every time the entity components get changed Can be checked with an older one to determine if the entity components have changed

◆ GetComponentsByTypeId()

virtual void IEntity::GetComponentsByTypeId ( const CryInterfaceID & interfaceID,
DynArray< IEntityComponent *> & components
) const
pure virtual

Return all components with the specified class ID contained in the entity.

Parameters
interfaceIDIdentifier for the component implementation.

◆ GetEditorObjectID()

virtual uint32 IEntity::GetEditorObjectID ( ) const
pure virtual

ObjectID that corresponds to editor base objects. This is used for selection and highlighting so it should be set by editor and have a 1-1 correspondence with a baseobject. This is intended as a runtime ID and does not need to be serialized

virtual IEntityLink* IEntity::GetEntityLinks ( )
pure virtual

Entity links.

Gets pointer to the first entity link.

◆ GetGeomCacheRenderNode()

virtual IGeomCacheRenderNode* IEntity::GetGeomCacheRenderNode ( int nSlot)
pure virtual

Fast method to get the geom cache render cache at the specified slot.

Parameters
nSlotIndex of the slot.
Returns
IGeomCacheRenderNode pointer or NULL if stat object with this slot does not exist.

◆ GetGuid()

virtual const EntityGUID& IEntity::GetGuid ( ) const
pure virtual

Retrieves the globally unique identifier of this entity assigned to it by the Entity System. EntityGuid is guaranteed to be the same when saving / loading entity, it is also same in the editor and in the game.

Returns
The entity globally unique identifier.

◆ GetId()

virtual EntityId IEntity::GetId ( ) const
pure virtual

Retrieves the runtime unique identifier of this entity assigned to it by the Entity System. EntityId may not be the same when saving/loading entity EntityId is not unique across the network, but can be serialized via the 'eid' compression policy EntityId is mostly used in runtime for fast and unique identification of entities, as the system allows for an O(1) retrieval

Returns
The entity instance's identifier

◆ GetLastSeenTime()

virtual float IEntity::GetLastSeenTime ( ) const
pure virtual
Returns
the last time (as set by the system timer) when the entity was last seen.

◆ GetLocalBounds()

virtual void IEntity::GetLocalBounds ( AABB & bbox) const
pure virtual

Retrieves the entity axis aligned bounding box in the local entity space.

Parameters
bboxOutput parameter for the bounding box.

◆ GetLocalSimParent()

virtual IEntity* IEntity::GetLocalSimParent ( ) const
pure virtual

Retrieves the parent of this entity if the parent is a local simulation grid

Returns
Pointer to the parent entity interface, or NULL if this entity does not have a parent or the parent is not a local simulation grid.

◆ GetLocalTM()

virtual Matrix34 IEntity::GetLocalTM ( ) const
pure virtual

Retrieves the entity transformation matrix in the local entity space.

Returns
Local space transformation matrix.

◆ GetMaterial()

virtual IMaterial* IEntity::GetMaterial ( )
pure virtual

Retrieves a custom material set to the entity.

Returns
Pointer to custom material interface or NULL if custom material not set.

◆ GetName()

virtual const char* IEntity::GetName ( ) const
pure virtual

Gets entity name.

Returns
Name of the entity.

◆ GetNetEntity()

virtual INetEntity* IEntity::GetNetEntity ( )
pure virtual

Returns the network proxy associated with the entity. Use the proxy to modify the entity's network behavior.

◆ GetOrCreateComponent()

template
ComponentType* IEntity::GetOrCreateComponent ( bool bCheckHierarchy = true)
inline

Get existing or Create a new initialized component inside the entity.

Parameters
bCheckHierarchyWhether or not we should traverse the inheritance hierarchy for all components, otherwise performs a (much faster) equality check to see if the implementation is ComponentType

◆ GetParent()

virtual IEntity* IEntity::GetParent ( ) const
pure virtual

Retrieves the parent of this entity.

Returns
Pointer to the parent entity interface, or NULL if this entity does not have a parent.

◆ GetParentAttachPointWorldTM()

virtual Matrix34 IEntity::GetParentAttachPointWorldTM ( ) const
pure virtual

Retrieves the TM of the point this entity is attached to if it has a parent.

Note
This can be different from GetParent()->GetWorldTM() when the attachment point is not the pivot.
Returns
World space matrix of the parent attachment transform

◆ GetParticleEmitter()

virtual IParticleEmitter* IEntity::GetParticleEmitter ( int nSlot)
pure virtual

Fast method to get the particle em at the specified slot.

Parameters
nSlotIndex of the slot.
Returns
IParticleEmitter pointer or NULL if stat object with this slot does not exist.

◆ GetPhysics()

virtual IPhysicalEntity* IEntity::GetPhysics ( ) const
pure virtual
Returns
A physical entity assigned to an entity.

◆ GetPhysicsWorldBounds()

virtual void IEntity::GetPhysicsWorldBounds ( AABB & bounds) const
pure virtual

Get world bounds of physical object.

Parameters
[out]boundsBounding box in world space.

◆ GetProxy()

virtual IEntityComponent* IEntity::GetProxy ( EEntityProxy proxy) const
pure virtual

Retrieves a pointer to the specified proxy interface in the entity.

Parameters
proxyProxy interface identifier.
Returns
Valid pointer to the requested entity proxy object, or NULL if such proxy not exist.

◆ GetRenderMaterial()

virtual IMaterial* IEntity::GetRenderMaterial ( int nSlot = -1) const
pure virtual

Retrieve an actual material used for rendering specified slot. Will return custom applied material or if custom material not set will return an actual material assigned to the slot geometry.

Parameters
nSlotSlot to query used material from, if -1 material will be taken from the first renderable slot.
Returns
Material used for rendering, or NULL if slot is not rendered.

◆ GetRenderNode()

virtual IRenderNode* IEntity::GetRenderNode ( int nSlot = -1) const
pure virtual

Retrieve 3D Engine render node, used to render this entity for a given slot. If nSlot is -1 return first existing render node in slots.

◆ GetSerializableNetworkSpawnInfo()

virtual ISerializableInfoPtr IEntity::GetSerializableNetworkSpawnInfo ( ) const
pure virtual

Called by networking on the server to serialize entity information in order to replicate the entity (and its components) on a remote host. The data is then deserialized on the remote host via SEntitySpawnParams::pSpawnSerializer. This function will collect information from components by calling IEntityComponent::NetReplicateSerialize.

◆ GetSlotFlags()

virtual uint32 IEntity::GetSlotFlags ( int nSlot) const
pure virtual

Retrieves the flags of the specified slot.

Parameters
nSlotIndex of the slot.
Returns
Slot flags, or 0 if specified slot is not valid.

◆ GetSlotInfo()

virtual bool IEntity::GetSlotInfo ( int nIndex,
SEntitySlotInfo & slotInfo
) const
pure virtual

Gets object slot information.

Parameters
nIndexIndex of required slot.
slotInfoOutput variable where description of the slot will be written.

◆ GetSlotLocalTM()

virtual Matrix34 IEntity::GetSlotLocalTM ( int nSlot,
bool bRelativeToParent
) const
pure virtual
Returns
Local transformation matrix relative to host entity transformation matrix of the object slot.
Parameters
nSlot- Index of required slot.
bRelativeToParent- flag specifying whether the local transformation matrix is relative to the parent slot or the entity.

◆ GetSlotMaterial()

virtual IMaterial* IEntity::GetSlotMaterial ( int nSlot) const
pure virtual

Retrieve slot's custom material (This material Must have been applied before with the SetSlotMaterial).

Parameters
nSlotSlot to query custom material from.
Returns
Custom material applied on the slot.

◆ GetSlotWorldTM()

virtual Matrix34 IEntity::GetSlotWorldTM ( int nSlot) const
pure virtual
Returns
World transformation matrix of the object slot.

◆ GetStatObj()

virtual IStatObj* IEntity::GetStatObj ( int nSlot)
pure virtual

Fast method to get the static object at the specified slot.

Parameters
nSlotIndex of the slot; | with ENTITY_SLOT_ACTUAL to disable compound statobj handling.
Returns
StatObj pointer or NULL if stat object with this slot does not exist.

◆ GetSubObjHideMask()

virtual hidemask IEntity::GetSubObjHideMask ( int nSlot) const
pure virtual

Retrieve sub-object hide mask from slot.

Parameters
nSlotSlot to apply hide mask to.

◆ GetWorldBounds()

virtual void IEntity::GetWorldBounds ( AABB & bbox) const
pure virtual

Retrieves the entity axis aligned bounding box in the world space.

Parameters
bboxOutput parameter for the bounding box.

◆ GetWorldTM()

virtual const Matrix34& IEntity::GetWorldTM ( ) const
pure virtual

Retrieves the entity transformation matrix in the world space.

Returns
World space transformation matrix (Include transformations of all parent entities).

◆ HandleVariableChange()

virtual bool IEntity::HandleVariableChange ( const char * szVarName,
const void * pVarData
)
pure virtual

LiveCreate entity manipulation. Process the LiveCreate message with a variable change. This function is used as low-latency update vs updating the whole entity.

Returns
true if handled, false otherwise

◆ Hide()

virtual void IEntity::Hide ( bool bHide,
EEntityHideFlags hideFlags = ENTITY_HIDE_NO_FLAG
)
pure virtual

Hides this entity, makes it invisible and disable its physics.

Parameters
bHideIf true hide the entity, is false unhides it.

◆ IncKeepAliveCounter()

virtual void IEntity::IncKeepAliveCounter ( )
pure virtual

Increase/or decrease KeepAliveCounter Used as a refcount to prevent deletion when deferring some events (like physics collisions which can refer these entities).

◆ Invisible()

virtual void IEntity::Invisible ( bool bInvisible)
pure virtual

Makes the entity invisible and disable its physics. Different from hide in that the entity is still updated.

◆ IsGarbage()

virtual bool IEntity::IsGarbage ( ) const
pure virtual

Checks if this entity was marked for deletion. If this function returns true, it will be deleted on next frame, and it is pointless to perform any operations on such entity.

Returns
True if entity marked for deletion, false otherwise.

◆ IsLoadedFromLevelFile()

virtual bool IEntity::IsLoadedFromLevelFile ( ) const
pure virtual
Return values
trueif this entity was loaded from level file.
falsefor entities created dynamically.

◆ IsParentAttachmentValid()

virtual bool IEntity::IsParentAttachmentValid ( ) const
pure virtual
Returns
true if the matrix returned by GetParentAttachPointWorldTM is valid, otherwise false.

◆ IsRendered()

virtual bool IEntity::IsRendered ( ) const
pure virtual

Check if Entity is being Rendered by 3dengine. It doesn't necessary mean that it will be visible on screen but only that 3d engine considers it for a rendering now

◆ IsSlotValid()

virtual bool IEntity::IsSlotValid ( int nIndex) const
pure virtual

Check if the slot with specified index exist.

Parameters
nIndexIndex of required slot.

◆ KillTimer()

virtual void IEntity::KillTimer ( int nTimerId)
pure virtual

Stops already started entity timer with this id.

Parameters
nTimerIdTimer ID of the timer started for this entity. (specify IEntity::KILL_ALL_TIMER to stop all timer on this entity)

◆ LoadCharacter()

virtual int IEntity::LoadCharacter ( int nSlot,
const char * sFilename,
int nLoadFlags = 0
)
pure virtual

Loads character to the specified slot, or to next available slot. If same character is already loaded in this slot, operation is ignored. If this slot number is occupied by different kind of object it is overwritten.

Returns
Slot id where the object was loaded, or -1 if loading failed.
#include 

// Load a character definition (.CDF) file into the next available entity slot
void LoadCharacter(IEntity& entity)
{
    // For the sake of this example, load the character definition from /Characters/MyCharacter.cdf
    const char* szCharacterPath = "Characters/MyCharacter.cdf";
    // Load the specified CDF into the next available slot
    const int slotId = entity.LoadCharacter(-1, szCharacterPath);
    // Attempt to query the character instance, will always succeed if the file was successfully loaded from disk
    if (ICharacterInstance* pCharacter = entity.GetCharacter(slotId))
    {
        /* pCharacter can now be used to manipulate and query the rendered character */
    }
}

◆ LoadFogVolume()

virtual int IEntity::LoadFogVolume ( int nSlot,
const SFogVolumeProperties & properties
)
pure virtual

Loads a fog volume to the specified slot, or to the next available slot.

Returns
Slot id where the fog volume was loaded, or -1 if loading failed.
#include 
#include 

void LoadFogVolume(IEntity& entity)
{
    // Create a SFogVolumeProperties instance to define the fog volume characteristics
    SFogVolumeProperties fogProperties;
    // Render the volume as a box
    fogProperties.m_volumeType = IFogVolumeRenderNode::eFogVolumeType_Box;
    // Render as a 1x1x1m box
    fogProperties.m_size = Vec3(1, 1, 1);
    // Set color to red (range is 0 - 1)
    fogProperties.m_color = ColorF(1, 0, 0, 1);

    // Helpers to convert emission intensity to the engine's format
    const float kiloScale = 1000.0f;
    const float toLightUnitScale = kiloScale / RENDERER_LIGHT_UNIT_SCALE;

    // Specify the desired emitted color, in our case red.
    ColorF emission = ColorF(1, 0, 0, 1);
    // Scale the intensity of the emission
    const float emissionIntensity = 1.f;
    emission.adjust_luminance(emissionIntensity * toLightUnitScale);

    // Apply the calculated emission to the fog properties
    fogProperties.m_emission = emission.toVec3();

    // Load the fog volume into the next available slot
    const int loadedSlotId = entity.LoadFogVolume(-1, fogProperties);
}

◆ LoadGeomCache()

virtual int IEntity::LoadGeomCache ( int nSlot,
const char * sFilename
)
pure virtual

Loads geometry cache to the specified slot, or to next available slot. If same geometry cache is already loaded in this slot, operation is ignored. If this slot number is occupied by different kind of object it is overwritten.

Returns
Slot id where the object was loaded, or -1 if loading failed.
#include 

// Load an alembic / geom cache file into the next available entity slot
void LoadGeomCache(IEntity& entity)
{
    // For the sake of this example, load the geometry cache from  /MyGeomCache.cbc
    const char* szGeomCachePath = "MyGeomCache.cbc";
    // Load the alembic definition into the next available slot
    int slotId = entity.LoadGeomCache(-1, szGeomCachePath);
    // Attempt to query the render node, will always succeed if the file was successfully loaded from disk
    if (IGeomCacheRenderNode* pRenderNode = entity.GetGeomCacheRenderNode(slotId))
    {
        /* pRenderNode can now be used to manipulate geom cache playback */
    }
}

◆ LoadGeometry()

virtual int IEntity::LoadGeometry ( int nSlot,
const char * sFilename,
const char * sGeomName = NULL,
int nLoadFlags = 0
)
pure virtual

Loads static geometry to the specified slot, or to next available slot. If same object is already loaded in this slot, operation is ignored. If this slot number is occupied by different kind of object it is overwritten with static object.

Parameters
nLoadFlagsSee ELoadFlags
See also
ELoadFlags
Returns
Slot id where the object was loaded, or -1 if loading failed.
#include 

// Load a static geometry (.CGF) file into the next available entity slot
void LoadGeometry(IEntity& entity)
{
    // For the sake of this example, load the static geometry from /Objects/MyBrush.cgf
    const char* szGeometryPath = "Objects/MyBrush.cgf";
    // Load the specified CGF into the next available slot
    const int slotId = entity.LoadGeometry(-1, szGeometryPath);
    // Attempt to query the IStatObj pointer, will always succeed if the file was successfully loaded from disk
    if (IStatObj* pStatObj = entity.GetStatObj(slotId))
    {
        /* 
            pStatObj can now be used to query the rendered geometry
            Note that pStatObj does *not* represent an instance, any modifications will modify all instances.
        */
    }
}

◆ LoadLight()

virtual int IEntity::LoadLight ( int nSlot,
SRenderLight * pLight
)
pure virtual

Loads a light source to the specified slot, or to next available slot.

Returns
Slot id where the light source was loaded, or -1 if loading failed.
#include 
#include 

// Loads a dynamic point light into the next available entity slot
void LoadPointLight(IEntity& entity)
{
    // Create the CDLight structure
    SRenderLight light;
    // Create a deferred point light that only affects the current area
    light.m_Flags = DLF_DEFERRED_LIGHT | DLF_THIS_AREA_ONLY | DLF_POINT;
    // Emit in a 10 meter radius
    light.m_fRadius = 10.f;
    // Set the color to pure white (RGBA), on a scale of 0 - 1
    light.SetLightColor(ColorF(1.f, 1.f, 1.f, 1.f));

    // Load the light into the next available entity slot
    const int lightSlot = entity.LoadLight(-1, &light);
}

// Loads a dynamic projector light into the next available entity slot
void LoadProjectorLight(IEntity& entity)
{
    // Create the CDLight structure
    SRenderLight light;
    // Create a deferred projector light that only affects the current area
    light.m_Flags = DLF_DEFERRED_LIGHT | DLF_THIS_AREA_ONLY | DLF_PROJECT;
    // Emit at a distance of 10 meters
    light.m_fRadius = 10.f;
    // Set the color to pure white (RGBA), on a scale of 0 - 1
    light.SetLightColor(ColorF(1.f, 1.f, 1.f, 1.f));

    // Load a sample projector texture from the engine assets (included with all projects)
    const char* szProjectedTexturePath = "%ENGINEASSETS%/Textures/Lights/ce_logo_white.dds";
    // Load the texture we want to project onto other objects
    light.m_pLightImage = gEnv->pRenderer->EF_LoadTexture(szProjectedTexturePath, FT_DONT_STREAM);
    // Project in a 90-degree cone
    light.m_fLightFrustumAngle = 90;

    // Load the light into the next available entity slot
    const int lightSlot = entity.LoadLight(-1, &light);
}

◆ LoadParticleEmitter()

virtual int IEntity::LoadParticleEmitter ( int nSlot,
IParticleEffect * pEffect,
SpawnParams const * params = NULL,
bool bPrime = false,
bool bSerialize = false
)
pure virtual

Loads a new particle emitter to the specified slot, or to next available slot. If this slot number is occupied by different kind of object it is overwritten.

Returns
Slot id where the particle emitter was loaded, or -1 if loading failed.
#include 
#include 

// Creates a particle emitter into the specified entity slot that emits continuously emits a specific effect
void LoadParticleEmitter(IEntity& entity)
{
    // For the sake of this example, load the particle effect from /Particles/MyEffect.pfx2
    const char* szParticleEffectPath = "Particles/MyEffect.pfx2";
    if (IParticleEffect* pEffect = gEnv->pParticleManager->FindEffect(szParticleEffectPath, "ParticleLoadExample"))
    {
        // Create a new SpawnParams instance to define how our particles should behave
        SpawnParams spawnParams;
        /* The spawn params could be modified here, but we choose to use the default settings set up by the designer in the Particle Editor */

        // Create a particle emitter in the next available slot, using the specified spawn parameters
        const int slotId = entity.LoadParticleEmitter(-1, pEffect, &spawnParams);
    }
}

◆ MoveSlot()

virtual void IEntity::MoveSlot ( IEntity * targetIEnt,
int nSlot
)
pure virtual

Moves the contents of a render slot from one entity to another, will also move any associated physics.

Parameters
targetIEntEntity to receive the new slot info.
nSlotIndex of the slot.

◆ Physicalize()

virtual void IEntity::Physicalize ( SEntityPhysicalizeParams & params)
pure virtual

Physicalize entity by creating a PhysicalEntity based on a specified physical parameters

See also
IEntity::PhysicalizeSlot
#include 

// Simple example for physicalizing an entity and all of its slots
void Physicalize(IEntity& entity)
{
    // The SEntityPhysicalizeParams is used to describe how an entity should be physicalized
    SEntityPhysicalizeParams physicalizeParams;
    // The type indicates which IPhysicalEntity implementation to use, in our case we want a rigid entity that can be moved around in the world and influence other entities
    physicalizeParams.type = PE_RIGID;
    // Physical entities can specify either a mass, or a density - but never both. In our case, we specify a mass of 50 kilograms.
    // If density is specified, the mass is calculated based on volume.
    physicalizeParams.mass = 50.f;
    // It is possible to automatically physicalize a specific slot, or all. In our case, we choose to automatically create physics parts for each entity slot in our entity.
    physicalizeParams.nSlot = -1;

    // Call IEntity::Physicalize to create the physical entity
    entity.Physicalize(physicalizeParams);

    // Now query the physical entity, will return a valid entity if Physicalize succeeded.
    if (IPhysicalEntity* pPhysicalEntity = entity.GetPhysicalEntity())
    {
        /* pPhysicalEntity can now be used, valid until entity is dephysicalized */
    }
}

◆ PhysicalizeSlot()

virtual int IEntity::PhysicalizeSlot ( int slot,
SEntityPhysicalizeParams & params
)
pure virtual

Adds physical geometry to the physical entity tied to this entity, based on the slot (if present) Entity has to have been physicalized with IEntity::Physicalize first.

See also
IEntity::Physicalize
#include 

// Simple example for physicalizing an entity slot
void PhysicalizeSlot(IEntity& entity, const int slotId)
{
    // Entity must have been physicalized using IEntity::Physicalize first
    if (IPhysicalEntity* pPhysicalEntity = entity.GetPhysicalEntity())
    {
        SEntityPhysicalizeParams partPhysicalizeParams;
        // Specify the type of physicalization to use, has to be the same as the entity we are applying to
        partPhysicalizeParams.type = pPhysicalEntity->GetType();
        // Specify the slot identifier inside the physicalization parameters
        partPhysicalizeParams.nSlot = slotId;
        // Mass of this entity in kilograms
        // Note that mass and density cannot be specified at the same time, if density is specified then mass is calculated based on volume
        partPhysicalizeParams.mass = 10.f;

        // Now add the slot geometry to our physical entity
        entity.PhysicalizeSlot(slotId, partPhysicalizeParams);
    }
}

◆ PreviewRender()

virtual void IEntity::PreviewRender ( SEntityPreviewContext & context)
pure virtual

Render a preview of the Entity This method is not used when entity is normally rendered But only used for previewing the entity in the Sandbox Editor

◆ RemoveAllComponents()

template
void IEntity::RemoveAllComponents ( bool checkHierarchy = true)
inline

Removes all instances of the specified component type found in the entity

Parameters
checkHierarchyWhether or not we should traverse the inheritance hierarchy for all components, otherwise performs a (much faster) equality check to see if the implementation is ComponentType

◆ RemoveComponent() [1/2]

virtual void IEntity::RemoveComponent ( IEntityComponent * pComponent)
pure virtual

Remove previously created component from the Entity

Parameters
pComponentComponent pointer to remove from the Entity

◆ RemoveComponent() [2/2]

template
void IEntity::RemoveComponent ( bool checkHierarchy = true)
inline

Removes the first instance of the specified component type found in the entity

Parameters
checkHierarchyWhether or not we should traverse the inheritance hierarchy for all components, otherwise performs a (much faster) equality check to see if the implementation is ComponentType

◆ ReplaceComponent()

virtual void IEntity::ReplaceComponent ( IEntityComponent * pExistingComponent,
std::shared_ptr< IEntityComponent > pNewComponent
)
pure virtual

Replaces an existing component in the entity with another, without shutting down the existing component Used for reallocating components at run-time while keeping internal state intact Note that this function does not copy any data between the components, that is up to the caller.

◆ SendEvent()

virtual bool IEntity::SendEvent ( const SEntityEvent & event)
pure virtual

Sends event to the entity.

Parameters
eventEvent description (event id, parameters).

◆ Serialize()

virtual void IEntity::Serialize ( TSerialize serializer,
int nFlags = 0
)
pure virtual

Saves or loads entity parameters to/from stream using serialization context class.

Parameters
serializerSerialization context class, provides all the information needed to properly serialize entity contents.
nFlagsAdditional custom serialization flags.

◆ SetCharacter()

virtual int IEntity::SetCharacter ( ICharacterInstance * pCharacter,
int nSlot,
bool bUpdatePhysics = true
)
pure virtual

Sets character instance of a slot, and creates slot if necessary.

Parameters
nSlotIndex of a slot, or -1 if a new slot need to be allocated.
pCharacterA pointer to character instance.
Returns
An integer which refers to the slot index which used.

◆ SetFlags()

virtual void IEntity::SetFlags ( uint32 flags)
pure virtual

Sets entity flags, completely replaces all flags which are already set in the entity.

Parameters
flagsFlag values which are defined in EEntityFlags.

◆ SetFlagsExtended()

virtual void IEntity::SetFlagsExtended ( uint32 flags)
pure virtual

Sets entity flags, completely replaces all flags which are already set in the entity.

Parameters
flags- Extended flag values which are defined in EEntityFlagsExtended.

◆ SetLocalBounds()

virtual void IEntity::SetLocalBounds ( const AABB & bounds,
bool bDoNotRecalculate
)
pure virtual

Force local bounds.

Parameters
[out]boundsBounding box in local space.
bDoNotRecalculateWhen set to true entity will never try to recalculate local bounding box set by this call.

◆ SetLocalTM()

virtual void IEntity::SetLocalTM ( const Matrix34 & tm,
EntityTransformationFlagsMask transformReasons = EntityTransformationFlagsMask()
)
pure virtual

Sets entity transformation matrix in the local entity space.

Parameters
tmLocal space transformation matrix (Non unifrorm scale is not supported).

◆ SetMaterial()

virtual void IEntity::SetMaterial ( IMaterial * pMaterial)
pure virtual

Assigns a custom material to the entity.

Parameters
pMaterialPointer to custom material interface.

◆ SetName()

virtual void IEntity::SetName ( const char * sName)
pure virtual

Changes the entity name. Entity name does not have to be unique, but for the sake of easier finding entities by name it is better to not assign the same name to different entities.

Parameters
sNameNew name for the entity.

◆ SetParentSlot()

virtual bool IEntity::SetParentSlot ( int nParentIndex,
int nChildIndex
)
pure virtual

Attaches child slot to the parent slot. This will form hierarchical transformation relationship between object slots.

Parameters
nParentIndexIndex of the parent slot (Child slot will be attached to this one).
nChildIndexIndex of the child slot.

◆ SetParticleEmitter()

virtual int IEntity::SetParticleEmitter ( int nSlot,
IParticleEmitter * pEmitter,
bool bSerialize = false
)
pure virtual

Sets an existing particle emitter to the specified slot, or the next available slot. If this slot number is occupied by different kind of object it is overwritten.

Returns
Slot id where the particle emitter was loaded, or -1 if loading failed.

◆ SetSlotFlags()

virtual void IEntity::SetSlotFlags ( int nSlot,
uint32 nFlags
)
pure virtual

Sets the flags of the specified slot.

Parameters
nSlotIndex of the slot, if -1 apply to all existing slots.
nFlagsFlags to set.

◆ SetSlotMaterial()

virtual void IEntity::SetSlotMaterial ( int nSlot,
IMaterial * pMaterial
)
pure virtual

Assigns a custom material to the specified object slot.

Parameters
nSlotIndex of the slot, if -1 assign this material to all existing slots.
pMaterialPointer to custom material interface.

◆ SetStatObj()

virtual int IEntity::SetStatObj ( IStatObj * pStatObj,
int nSlot,
bool bUpdatePhysics,
float mass = -1.0f
)
pure virtual

Sets static object of a slot, creates slot if necessary

Parameters
nSlotIndex of a slot, or -1 if a new slot need to be allocated; | with ENTITY_SLOT_ACTUAL to disable compound statobj handling.
pStatObjPointer to the new static object.
massNew mass of the slot, negative value to keep the current.
Returns
Integer which refer to the slot index which used

◆ SetSubObjHideMask()

virtual void IEntity::SetSubObjHideMask ( int nSlot,
hidemask nSubObjHideMask
)
pure virtual

Assign sub-object hide mask to slot.

Parameters
nSlotSlot to apply hide mask to.

◆ SetTimer()

virtual int IEntity::SetTimer ( int nTimerId,
int nMilliSeconds
)
pure virtual

Starts the entity timer. Entity timers are owned by entity, every entity can have it`s own independent timers, so TimerId must not be unique across multiple entities. When timer finishes entity system will signal to the entity once with an event ENTITY_EVENT_TIME. Multiple timers can be started simultaneously with different timer ids. If some timer is not yet finished and another timer with the same timerID is set, the new one will override old timer, and old timer will not send finish event.

Parameters
nTimerIdTimer ID, multiple timers with different IDs are possible. (specify IEntity::CREATE_NEW_UNIQUE_TIMER_ID to let the system generate a new and unique Id)
nMilliSecondsTimer timeout time in milliseconds.
Returns
the (generated) timerId

◆ SetWorldTM()

virtual void IEntity::SetWorldTM ( const Matrix34 & tm,
EntityTransformationFlagsMask transformReasons = EntityTransformationFlagsMask()
)
pure virtual

Sets entity transformation matrix in the world space.

Parameters
tmWorld space transformation matrix (Non unifrorm scale is not supported).

◆ ShouldUpdateCharacter()

virtual bool IEntity::ShouldUpdateCharacter ( int nSlot) const
pure virtual
Parameters
nSlot- Index of the slot.
Returns
true if character is to be updated, otherwise false.

◆ UnmapAttachedChild()

virtual IEntity* IEntity::UnmapAttachedChild ( int & partId)
pure virtual
Parameters
[out]partIdSet to the child's partId.
Returns
An attached child entity that corresponds to the physical part partId.

◆ UpdateComponentEventMask()

virtual void IEntity::UpdateComponentEventMask ( const IEntityComponent * pComponent)
pure virtual

Used to update the stored mask for a certain component, from IEntityComponent::GetEventMask For example, changing IEntityComponent::GetEventMask to return ENTITY_EVENT_UPDATE and then calling GetEventMask will result in the component and its entity being updated the next frame.

#include 

class CMyEventComponent final : public IEntityComponent
{
public:
    // Provide a virtual destructor, ensuring correct destruction of IEntityComponent members
    virtual ~CMyEventComponent() = default;

    static void ReflectType(Schematyc::CTypeDesc& desc) { /* Reflect the component GUID in here. */}

    // Override the ProcessEvent function to receive the callback whenever an event specified in GetEventMask is triggered
    virtual void ProcessEvent(const SEntityEvent& event) override
    {
        // Check if this is the update event
        if (event.event == ENTITY_EVENT_UPDATE)
        {
            // The Update event provides delta time as the first floating-point parameter
            const float frameTime = event.fParam[0];

            /* Handle update logic here */
        }
    }

    // As an optimization, components have to specify a bitmask of the events that they want to handle
    // This is called once at component creation, and then only if IEntity::UpdateComponentEventMask is called, to support dynamic change of desired events (useful for disabling update when you don't need it)
    virtual uint64 GetEventMask() const override { return BIT64(ENTITY_EVENT_UPDATE); }
};

◆ VisitComponents()

virtual void IEntity::VisitComponents ( const ComponentsVisitor & visitor)
pure virtual

Calls a callback on all of the components in the entity This is a more efficient way to operate on components then using GetComponents method as it is not require temporary allocations