IEntityAreaComponent

IEntityAreaComponentabstract

#include

Inherits IEntityComponent.

Public Types

enum EAreaComponentFlags { FLAG_NOT_UPDATE_AREA = BIT(1), FLAG_NOT_SERIALIZE = BIT(2) }
- Public Types inherited from IEntityComponent
typedef int ComponentEventPriority
typedef EEntityComponentFlags EFlags
typedef EntityComponentFlags ComponentFlags

Public Member Functions

virtual void SetFlags (int nAreaComponentFlags)=0
Area flags.
virtual int GetFlags ()=0
Area flags.
virtual EEntityAreaType GetAreaType () const =0
virtual struct IArea * GetArea () const =0
Get the actual area referenced by this component.
virtual void SetPoints (Vec3 const *const pPoints, bool const *const pSoundObstructionSegments, size_t const numLocalPoints, bool const bClosed, float const height)=0
virtual void SetBox (const Vec3 &min, const Vec3 &max, const bool *const pabSoundObstructionSides, size_t const nSideCount)=0
virtual void SetSphere (const Vec3 &vCenter, float fRadius)=0
virtual void BeginSettingSolid (const Matrix34 &worldTM)=0
virtual void AddConvexHullToSolid (const Vec3 *verticesOfConvexHull, bool bObstruction, int numberOfVertices)=0
virtual void EndSettingSolid ()=0
virtual int GetPointsCount ()=0
Retrieve number of points for shape area, return 0 if not area type is not shape.
virtual const Vec3 * GetPoints ()=0
Retrieve array of points for shape area, will return NULL for all other area types.
virtual void SetHeight (float const value)=0
Set shape area height, if height is 0 area is 2D.
virtual float GetHeight () const =0
Retrieve shape area height, if height is 0 area is 2D.
virtual void GetBox (Vec3 &min, Vec3 &max)=0
Retrieve min and max in local space of area box.
virtual void GetSphere (Vec3 &vCenter, float &fRadius)=0
Retrieve center and radius of the sphere area in local space.
virtual void SetGravityVolume (const Vec3 *pPoints, int nNumPoints, float fRadius, float fGravity, bool bDontDisableInvisible, float fFalloff, float fDamping)=0
virtual void SetID (const int id)=0
Set area ID, this id will be provided to the script callback OnEnterArea, OnLeaveArea.
virtual int GetID () const =0
Retrieve area ID.
virtual void SetGroup (const int id)=0
virtual int GetGroup () const =0
Retrieve area group id.
virtual void SetPriority (const int nPriority)=0
virtual int GetPriority () const =0
Retrieve area priority.
virtual void SetSoundObstructionOnAreaFace (size_t const index, bool const bObstructs)=0
Sets sound obstruction depending on area type.
virtual void AddEntity (EntityId id)=0
virtual void AddEntity (EntityGUID guid)=0
virtual void RemoveEntity (EntityId const id)=0
virtual void RemoveEntity (EntityGUID const guid)=0
virtual void RemoveEntities ()=0
Removes all added target entities.
virtual void SetProximity (float fProximity)=0
virtual float GetProximity ()=0
Retrieves area proximity.
virtual float CalcPointNearDistSq (EntityId const nEntityID, Vec3 const &Point3d, Vec3 &OnHull3d)=0
virtual float ClosestPointOnHullDistSq (EntityId const nEntityID, Vec3 const &Point3d, Vec3 &OnHull3d)=0
virtual bool CalcPointWithin (EntityId const nEntityID, Vec3 const &Point3d, bool const bIgnoreHeight=false) const =0
virtual size_t GetNumberOfEntitiesInArea () const =0
get number of entities in area
virtual EntityId GetEntityInAreaByIdx (size_t const index) const =0
get entity in area by index
virtual float GetInnerFadeDistance () const =0
Retrieve inner fade distance of this area.
virtual void SetInnerFadeDistance (float const distance)=0
Set this area's inner fade distance.
- Public Member Functions inherited from IEntityComponent
virtual ICryFactory * GetFactory () const
ILINE IEntity * GetEntity () const
ILINE EntityId GetEntityId () const
IEntityComponent (IEntityComponent &&other)
IEntityComponent (const IEntityComponent &)=default
IEntityComponent & operator= (const IEntityComponent &)=default
IEntityComponent & operator= (IEntityComponent &&)=default
const CEntityComponentClassDesc & GetClassDesc () const
virtual uint64 GetEventMask () const
virtual ComponentEventPriority GetEventPriority () const
Determines the order in which this component will receive entity events (including update). Lower number indicates a higher priority.
virtual NetworkAspectType GetNetSerializeAspectMask () const
Network serialization. Override to provide a mask of active network aspects used by this component. Called once during binding to network. More...
virtual bool NetSerialize (TSerialize ser, EEntityAspects aspect, uint8 profile, int flags)
Network serialization. Will be called for each active aspect for both reading and writing. More...
virtual void NetReplicateSerialize (TSerialize ser)
virtual void NetMarkAspectsDirty (const NetworkAspectType aspects)
Call this to trigger aspect synchronization over the network. A shortcut. More...
virtual IEntityComponentPreviewer * GetPreviewer ()
Override this to return preview render interface for the component. Multiple component instances can usually share the same previewer class instance. More...
void SetComponentFlags (ComponentFlags flags)
END IEntityComponent virtual interface. More...
const ComponentFlags & GetComponentFlags () const
Return flags for this component.
ComponentFlags & GetComponentFlags ()
const CryGUID & GetGUID () const
IEntityComponent * GetParent () const
const CryTransform::CTransformPtr & GetTransform () const
Return Transformation of the entity component relative to the owning entity or parent component.
void SetTransformMatrix (const Matrix34 &transform)
Sets the transformation form a matrix. If the component doesn't have a transformation yet the function will add one.
void SetTransformMatrix (const CryTransform::CTransformPtr &transform)
Sets the transformation from another transformation. If the component doesn't have a transformation yet the function will add one.
Matrix34 GetWorldTransformMatrix () const
Return Transformation of the entity component relative to the world.
Matrix34 GetTransformMatrix () const
Return Calculated Transformation Matrix for current component transform.
const char * GetName () const
Get name of this individual component, usually only Schematyc components will have names.
void SetName (const char *szName)
int GetEntitySlotId () const
Return optional EntitySlot id used by this Component.
int GetOrMakeEntitySlotId ()
void SetEntitySlotId (int slotId)
Stores Entity slot id used by this component.
void FreeEntitySlot ()
Frees entity slot used by this component.
EEntitySimulationMode GetEntitySimulationMode () const
Return Current simulation mode of the host Entity.
void SendEvent (const SEntityEvent &event)
virtual void GetMemoryUsage (ICrySizer *pSizer) const
virtual void GameSerialize (TSerialize ser)
virtual bool NeedGameSerialize ()
virtual void LegacySerializeXML (XmlNodeRef &entityNode, XmlNodeRef &componentNode, bool bLoading)
virtual struct IEntityPropertyGroup * GetPropertyGroup ()
Only for backward compatibility to Release 5.3.0 for loading.
virtual EEntityProxy GetProxyType () const
Legacy, used for old entity proxies.

Additional Inherited Members

- Static Public Attributes inherited from IEntityComponent
static constexpr int EmptySlotId = -1
- Protected Member Functions inherited from IEntityComponent
virtual void * QueryInterface (const CryInterfaceID &iid) const
virtual void * QueryComposite (const char *name) const
virtual void PreInit (const SInitParams &params)
virtual void Initialize ()
Called at the very first initialization of the component, at component creation time.
virtual void OnShutDown ()
Called on all Entity components right before all of the Entity Components are destructed.
virtual void OnTransformChanged ()
Called when the transformation of the component is changed.
virtual void ProcessEvent (const SEntityEvent &event)
- Protected Attributes inherited from IEntityComponent
friend IEntity
IEntity * m_pEntity = nullptr
ComponentFlags m_componentFlags
CryGUID m_guid
Unique GUID of the instance of this component.
string m_name
name of this component
CryTransform::CTransformPtr m_pTransform
Optional transformation setting for the component within the Entity object.
IEntityComponent * m_pParent = nullptr
Optional pointer to our parent component.
const CEntityComponentClassDesc * m_pClassDesc = nullptr
int m_entitySlotId = EmptySlotId
Optional Entity SlotId for storing component data like geometry of character.

Detailed Description

Area component allow for entity to host an area trigger. Area can be shape, box or sphere, when marked entities cross this area border, it will send ENTITY_EVENT_ENTERAREA, ENTITY_EVENT_LEAVEAREA, and ENTITY_EVENT_AREAFADE events to the target entities.

Member Enumeration Documentation

◆ EAreaComponentFlags

Enumerator
FLAG_NOT_UPDATE_AREA

When set points in the area will not be updated.

FLAG_NOT_SERIALIZE

Areas with this flag will not be serialized.

Member Function Documentation

◆ AddConvexHullToSolid()

virtual void IEntityAreaComponent::AddConvexHullToSolid ( const Vec3 * verticesOfConvexHull,
bool bObstruction,
int numberOfVertices
)
pure virtual

Add a convex hull to a solid. This function have to be called after calling BeginSettingSolid()

See also
BeginSettingSolid, EndSettingSolid

◆ AddEntity() [1/2]

virtual void IEntityAreaComponent::AddEntity ( EntityId id)
pure virtual

Add target entity to the area. When someone enters/leaves an area, it will send ENTERAREA, LEAVEAREA, AREAFADE, events to these target entities.

◆ AddEntity() [2/2]

virtual void IEntityAreaComponent::AddEntity ( EntityGUID guid)
pure virtual

Add target entity to the area. When someone enters/leaves an area, it will send ENTERAREA, LEAVEAREA, AREAFADE, events to these target entities.

◆ BeginSettingSolid()

virtual void IEntityAreaComponent::BeginSettingSolid ( const Matrix34 & worldTM)
pure virtual

This function need to be called before setting convex hulls for a AreaSolid. Then AddConvexHullSolid() function is called as the number of convexhulls consisting of a geometry.

See also
AddConvexHullToSolid, EndSettingSolid

◆ CalcPointNearDistSq()

virtual float IEntityAreaComponent::CalcPointNearDistSq ( EntityId const nEntityID,
Vec3 const & Point3d,
Vec3 & OnHull3d
)
pure virtual

Compute and return squared distance to a point which is outside OnHull3d is the closest point on the hull of the area

◆ CalcPointWithin()

virtual bool IEntityAreaComponent::CalcPointWithin ( EntityId const nEntityID,
Vec3 const & Point3d,
bool const bIgnoreHeight = false
) const
pure virtual

Checks if a given point is inside the area.

Note
Ignoring the height speeds up the check.

◆ ClosestPointOnHullDistSq()

virtual float IEntityAreaComponent::ClosestPointOnHullDistSq ( EntityId const nEntityID,
Vec3 const & Point3d,
Vec3 & OnHull3d
)
pure virtual

Computes and returns squared distance from a point to the hull of the area OnHull3d is the closest point on the hull of the area This function is not sensitive of if the point is inside or outside the area

◆ EndSettingSolid()

virtual void IEntityAreaComponent::EndSettingSolid ( )
pure virtual

Finish setting a solid geometry. Generally the BSPTree based on convex hulls which is set before is created in this function.

See also
BeginSettingSolid, AddConvexHullToSolid

◆ GetAreaType()

virtual EEntityAreaType IEntityAreaComponent::GetAreaType ( ) const
pure virtual

Retrieve area type.

Returns
One of EEntityAreaType enumerated types.

◆ RemoveEntity() [1/2]

virtual void IEntityAreaComponent::RemoveEntity ( EntityId const id)
pure virtual

Remove target entity from the area. When someone enters/leaves an area, it will send ENTERAREA, LEAVEAREA, AREAFADE, events to these target entities.

◆ RemoveEntity() [2/2]

virtual void IEntityAreaComponent::RemoveEntity ( EntityGUID const guid)
pure virtual

Remove target entity from the area. When someone enters/leaves an area, it will send ENTERAREA ,LEAVEAREA, AREAFADE, events to these target entities.

◆ SetBox()

virtual void IEntityAreaComponent::SetBox ( const Vec3 & min,
const Vec3 & max,
const bool *const pabSoundObstructionSides,
size_t const nSideCount
)
pure virtual

Sets area to be a Box, min and max must be in local entity space. Host entity orientation will define the actual world position and orientation of area box.

◆ SetGroup()

virtual void IEntityAreaComponent::SetGroup ( const int id)
pure virtual

Set area group id, areas with same group id act as an exclusive areas. If 2 areas with same group id overlap, entity will be considered in the most internal area (closest to entity).

◆ SetPoints()

virtual void IEntityAreaComponent::SetPoints ( Vec3 const *const pPoints,
bool const *const pSoundObstructionSegments,
size_t const numLocalPoints,
bool const bClosed,
float const height
)
pure virtual

Sets area to be a shape, and assign points to this shape. Points are specified in local entity space, shape will always be constructed in XY plane, lowest Z of specified points will be used as a base Z plane. If fHeight parameter is 0, shape will be considered 2D shape, and during intersection Z will be ignored If fHeight is not zero shape will be considered 3D and will accept intersection within vertical range from baseZ to baseZ+fHeight.

Parameters
pPointsArray of 3D vectors defining shape vertices.
pSoundObstructionSegmentsArray of corresponding booleans that indicate sound obstruction.
numLocalPointsNumber of vertices in vPoints array.
heightHeight of the shape.

◆ SetPriority()

virtual void IEntityAreaComponent::SetPriority ( const int nPriority)
pure virtual

Set priority defines the individual priority of an area, Area with same group id will depend on which has the higher priority

◆ SetProximity()

virtual void IEntityAreaComponent::SetProximity ( float fProximity)
pure virtual

Set area proximity region near the border. When someone is moving within this proximity region from the area outside border Area will generate ENTITY_EVENT_AREAFADE event to the target entity, with a fade ratio from 0, to 1. Where 0 will be at the area outside border, and 1 inside the area in distance fProximity from the outside area border.

◆ SetSphere()

virtual void IEntityAreaComponent::SetSphere ( const Vec3 & vCenter,
float fRadius
)
pure virtual

Sets area to be a Sphere, center and radius must be specified in local entity space. Host entity world position will define the actual world position of the area sphere.