Page tree
Skip to end of metadata
Go to start of metadata

Wrapper for the IEntity class of CRYENGINE. Provides properties and wraps functions for easier access of IEntity functions. Entity must not inherit from IEntity but keep an ID reference to it, for reasons of CRYENGINE internal entity representation. More...

Public Member Functions

void LoadMaterial (string path)
 Load a material from a path and set it as the current material. More...
 
void OnRemove ()
 Called before removing the entity from CRYENGINE's entity system. More...
 
void Remove ()
 Removes the Entity object from the scene. More...
 
T AddComponent< T > ()
 Adds a new instance of the component. More...
 
T GetComponent< T > ()
 Returns the first EntityComponent that matches the specified type. Returns null if nothing is found. More...
 
List< TGetComponents< T > ()
 Get all components that match the specified type. Returns null if nothing is found. More...
 
T GetComponentWithInterface< T > ()
 Gets the first EntityComponent that implements the specified interface. Returns null if nothing was found. More...
 
List< TGetComponentsWithInterface< T > ()
 Gets all components that implement the specified interface. Returns null if nothing was found. More...
 
T GetOrCreateComponent< T > ()
 Returns the first EntityComponent that matches the specified type, if it exists. Otherwise, adds a new instance of the component. More...
 
bool HasComponent< T > ()
 Returns true if this Entity has the specified EntityComponent, otherwise false. More...
 
void SetParent (Entity parent, bool keepWorldTransform=false)
 Set the parent Entity of this Entity. More...
 
void AttachChild (Entity child)
 Attach an Entity to this Entity as a child. More...
 
void AttachChild (Entity child, SChildAttachParams attachParams)
 Attach an Entity to this Entity as a child. The attach-behavior is defined in the attachParams. More...
 
void LoadParticleEmitter (int slot, ParticleEffect particleEffect, float scale=1.0f)
 Attaches a particle emitter object to a specific entity slot and loads it with particleEffect . More...
 
Vector3 GetHelperPos (int slot, string helperName)
 Returns the world coordinates of a specific helper in a specific entity slot. More...
 
void SetGeometrySlotLocalTransform (int slot, Matrix3x4 mx)
 Sets position, rotation and scale of an entity slot, ba a matrix. More...
 
void FreeGeometrySlot (int slot)
 Removes any geometry that was previously attached to an entity slot. More...
 
void LoadGeometry (int slot, string url)
 Loads a specific geometry into an entity slot. More...
 
int LoadCharacter (int slot, string url)
 Loads a 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 a different kind of object it is overwritten. More...
 
Character GetCharacter (int slot)
 Method to get the character at the specified slot. More...
 
void SetSlotFlag (int slot, EntitySlotFlags flags)
 Set the flags for a specific slot. More...
 
ParticleEmitter GetParticleEmitter (int slot)
 Returns a particle emitter on the basis of a given slot. More...
 
void LoadLight (int slot, DynamicLight light)
 Loads a light into a given slot. More...
 
void SetViewDistanceRatio (float viewDistanceRatio)
 Specify the ratio at which this entity is made invisible based on distance. Ratio is 0.0 - 1.0, with 1.0 being 100% visibility regardless of distance. More...
 

Static Public Member Functions

static Entity Get (EntityId id)
 Finds an entity by its entity id First attempts to find the entity in the managed cache, otherwise queries native code More...
 
static Entity Find (string name)
 Queries an entity by name First attempts to find the entity in the managed cache, otherwise queries native code More...
 
static Entity Spawn (string name, Vector3 position, Quaternion rotation, Vector3 scale)
 Spawns an empty without any components More...
 
static T SpawnWithComponent< T > (string name, Vector3 position, Quaternion rotation, Vector3 scale)
 Spawn a new Entity with the specified EntityComponent. More...
 
static T SpawnWithComponent< T > (Vector3 position, Quaternion rotation, float scale=1f)
 Spawn a new Entity with the specified EntityComponent. More...
 
static T SpawnWithComponent< T > (string name, Vector3 position, Quaternion rotation, float scale=1.0f)
 Spawn a new Entity with the specified EntityComponent. More...
 
static void Remove (EntityId id)
 Remove the entity with the specified id. More...
 

Properties

EntityId Id [get, set]
 Gets the unique identifier associated with this entity More...
 
Vector3 Position [get, set]
 Get or set the position of the Entity in local-space. More...
 
Vector3 WorldPosition [get, set]
 Get or set the position of the Entity in world-space. More...
 
Quaternion Rotation [get, set]
 Get or set the rotation of the Entity in local-space. More...
 
Quaternion WorldRotation [get, set]
 Get or set the rotation of the Entity in world-space. More...
 
Vector3 Scale [get, set]
 Get or set the scale of the Entity in local-space. More...
 
Vector3 Forward [get]
 Get the forward direction of the Entity in world-space. More...
 
string Name [get, set]
 Get or set the name of the Entity. More...
 
IMaterial Material [get, set]
 Get or set the Material of this Entity. More...
 
bool Hidden [get, set]
 Hide or unhide this T:CryEngine.Entity. More...
 
List< EntityChildren [get]
 Get a list of all the child Entities of this Entity. More...
 
Entity Parent [get, set]
 Gets or sets the parent of this Entity. Setting a new parent will keep the local-transform of this object. Use SetParent() to manually decide the behaviour when setting the parent. More...
 
bool Exists [get]
 Determines whether this Entity still exists in the engine. More...
 
Matrix3x4 Transform [get, set]
 The local transform-matrix of this Entity. More...
 
PhysicsEntity Physics [get]
 The representation of this Entity in the physics engine. More...
 

Detailed Description

Wrapper for the IEntity class of CRYENGINE. Provides properties and wraps functions for easier access of IEntity functions. Entity must not inherit from IEntity but keep an ID reference to it, for reasons of CRYENGINE internal entity representation.

Member Function Documentation

◆ AddComponent< T >()

T CryEngine.Entity.AddComponent< T > ( )
inline

Adds a new instance of the component.

Template Parameters
T
Returns
Type Constraints
T :EntityComponent 
T :new() 

◆ AttachChild() [1/2]

void CryEngine.Entity.AttachChild ( Entity  child)
inline

Attach an Entity to this Entity as a child.

Parameters
child

◆ AttachChild() [2/2]

void CryEngine.Entity.AttachChild ( Entity  child,
SChildAttachParams  attachParams 
)
inline

Attach an Entity to this Entity as a child. The attach-behavior is defined in the attachParams.

Parameters
child
attachParams

◆ Find()

static Entity CryEngine.Entity.Find ( string  name)
inlinestatic

Queries an entity by name First attempts to find the entity in the managed cache, otherwise queries native code

Parameters
name
Returns

◆ FreeGeometrySlot()

void CryEngine.Entity.FreeGeometrySlot ( int  slot)
inline

Removes any geometry that was previously attached to an entity slot.

Parameters
slotSlot.

◆ Get()

static Entity CryEngine.Entity.Get ( EntityId  id)
inlinestatic

Finds an entity by its entity id First attempts to find the entity in the managed cache, otherwise queries native code

Parameters
idEntityId

◆ GetCharacter()

Character CryEngine.Entity.GetCharacter ( int  slot)
inline

Method to get the character at the specified slot.

Parameters
slotThe index of the character slot.
Returns
The CharacterInstance or null if character with this slot does not exist.

◆ GetComponent< T >()

T CryEngine.Entity.GetComponent< T > ( )
inline

Returns the first EntityComponent that matches the specified type. Returns null if nothing is found.

Type Constraints
T :EntityComponent 

◆ GetComponents< T >()

List<T> CryEngine.Entity.GetComponents< T > ( )
inline

Get all components that match the specified type. Returns null if nothing is found.

Returns
Every EntityComponent that matches the type T .
Template Parameters
TThe type the components have to match.
Type Constraints
T :EntityComponent 

◆ GetComponentsWithInterface< T >()

List<T> CryEngine.Entity.GetComponentsWithInterface< T > ( )
inline

Gets all components that implement the specified interface. Returns null if nothing was found.

Returns
The components that implement the interface.
Template Parameters
TThe type of interface that has to be implemented.
Type Constraints
T :class 

◆ GetComponentWithInterface< T >()

T CryEngine.Entity.GetComponentWithInterface< T > ( )
inline

Gets the first EntityComponent that implements the specified interface. Returns null if nothing was found.

Returns
The component with interface.
Template Parameters
TThe type of interface that has to be implemented.
Type Constraints
T :class 

◆ GetHelperPos()

Vector3 CryEngine.Entity.GetHelperPos ( int  slot,
string  helperName 
)
inline

Returns the world coordinates of a specific helper in a specific entity slot.

Returns
The helper position.
Parameters
slotSlot.
helperNameHelper name.

◆ GetOrCreateComponent< T >()

T CryEngine.Entity.GetOrCreateComponent< T > ( )
inline

Returns the first EntityComponent that matches the specified type, if it exists. Otherwise, adds a new instance of the component.

Template Parameters
T
Returns
Type Constraints
T :EntityComponent 
T :new() 

◆ GetParticleEmitter()

ParticleEmitter CryEngine.Entity.GetParticleEmitter ( int  slot)
inline

Returns a particle emitter on the basis of a given slot.

Returns
The particle emitter.
Parameters
slotSlot.

◆ HasComponent< T >()

bool CryEngine.Entity.HasComponent< T > ( )
inline

Returns true if this Entity has the specified EntityComponent, otherwise false.

Template Parameters
T
Returns
Type Constraints
T :EntityComponent 

◆ LoadCharacter()

int CryEngine.Entity.LoadCharacter ( int  slot,
string  url 
)
inline

Loads a 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 a different kind of object it is overwritten.

Parameters
slotThe index of the character slot.
urlThe path to the character file.
Returns
Slot id where the object was loaded, or -1 if loading failed.

◆ LoadGeometry()

void CryEngine.Entity.LoadGeometry ( int  slot,
string  url 
)
inline

Loads a specific geometry into an entity slot.

Parameters
slotSlot.
urlURL.

◆ LoadLight()

void CryEngine.Entity.LoadLight ( int  slot,
DynamicLight  light 
)
inline

Loads a light into a given slot.

Parameters
slotSlot.
lightLight.

◆ LoadMaterial()

void CryEngine.Entity.LoadMaterial ( string  path)
inline

Load a material from a path and set it as the current material.

Parameters
path

◆ LoadParticleEmitter()

void CryEngine.Entity.LoadParticleEmitter ( int  slot,
ParticleEffect  particleEffect,
float  scale = 1.0f 
)
inline

Attaches a particle emitter object to a specific entity slot and loads it with particleEffect .

Parameters
slotThe slot to load the particle in.
particleEffectParticle effect to load.
scaleScale of the emitter.

◆ OnRemove()

void CryEngine.Entity.OnRemove ( )
inline

Called before removing the entity from CRYENGINE's entity system.

◆ Remove() [1/2]

static void CryEngine.Entity.Remove ( EntityId  id)
inlinestatic

Remove the entity with the specified id.

Parameters
id

◆ Remove() [2/2]

void CryEngine.Entity.Remove ( )
inline

Removes the Entity object from the scene.

◆ SetGeometrySlotLocalTransform()

void CryEngine.Entity.SetGeometrySlotLocalTransform ( int  slot,
Matrix3x4  mx 
)
inline

Sets position, rotation and scale of an entity slot, ba a matrix.

Parameters
slotSlot.
mxMx.

◆ SetParent()

void CryEngine.Entity.SetParent ( Entity  parent,
bool  keepWorldTransform = false 
)
inline

Set the parent Entity of this Entity.

Parameters
parent
keepWorldTransform

◆ SetSlotFlag()

void CryEngine.Entity.SetSlotFlag ( int  slot,
EntitySlotFlags  flags 
)
inline

Set the flags for a specific slot.

Parameters
slot
flags

◆ SetViewDistanceRatio()

void CryEngine.Entity.SetViewDistanceRatio ( float  viewDistanceRatio)
inline

Specify the ratio at which this entity is made invisible based on distance. Ratio is 0.0 - 1.0, with 1.0 being 100% visibility regardless of distance.

Parameters
viewDistanceRatioView distance ratio.

◆ Spawn()

static Entity CryEngine.Entity.Spawn ( string  name,
Vector3  position,
Quaternion  rotation,
Vector3  scale 
)
inlinestatic

Spawns an empty without any components

Parameters
nameName of the entity
positionInitial position of the entity
rotationInitial rotation of the entity
scaleInitial scale of the entity
Returns

◆ SpawnWithComponent< T >() [1/3]

static T CryEngine.Entity.SpawnWithComponent< T > ( string  name,
Vector3  position,
Quaternion  rotation,
Vector3  scale 
)
inlinestatic

Spawn a new Entity with the specified EntityComponent.

Returns
The component that's on the new Entity.
Parameters
nameThe name of the Entity in the level hierarchy.
positionPosition of the Entity.
rotationRotation of the Entity.
scaleScale of the Entity.
Template Parameters
TThe type of the EntityComponent.
Type Constraints
T :EntityComponent 
T :new() 

◆ SpawnWithComponent< T >() [2/3]

static T CryEngine.Entity.SpawnWithComponent< T > ( Vector3  position,
Quaternion  rotation,
float  scale = 1f 
)
inlinestatic

Spawn a new Entity with the specified EntityComponent.

Returns
The component that's on the new Entity.
Parameters
positionPosition of the Entity.
rotationRotation of the Entity.
scaleScale of the Entity.
Template Parameters
TThe type of the EntityComponent.
Type Constraints
T :EntityComponent 
T :new() 

◆ SpawnWithComponent< T >() [3/3]

static T CryEngine.Entity.SpawnWithComponent< T > ( string  name,
Vector3  position,
Quaternion  rotation,
float  scale = 1.0f 
)
inlinestatic

Spawn a new Entity with the specified EntityComponent.

Returns
The component that's on the new Entity.
Parameters
nameThe name of the Entity in the level hierarchy.
positionPosition of the Entity.
rotationRotation of the Entity.
scaleScale of the Entity.
Template Parameters
TThe type of the EntityComponent.
Type Constraints
T :EntityComponent 
T :new() 

Property Documentation

◆ Children

List<Entity> CryEngine.Entity.Children
get

Get a list of all the child Entities of this Entity.

◆ Exists

bool CryEngine.Entity.Exists
get

Determines whether this Entity still exists in the engine.

◆ Forward

Vector3 CryEngine.Entity.Forward
get

Get the forward direction of the Entity in world-space.

The forward.

◆ Hidden

bool CryEngine.Entity.Hidden
getset

Hide or unhide this T:CryEngine.Entity.

true if hidden; otherwise, false.

◆ Id

EntityId CryEngine.Entity.Id
getset

Gets the unique identifier associated with this entity

◆ Material

IMaterial CryEngine.Entity.Material
getset

Get or set the Material of this Entity.

◆ Name

string CryEngine.Entity.Name
getset

Get or set the name of the Entity.

◆ Parent

Entity CryEngine.Entity.Parent
getset

Gets or sets the parent of this Entity. Setting a new parent will keep the local-transform of this object. Use SetParent() to manually decide the behaviour when setting the parent.

The parent.

◆ Physics

PhysicsEntity CryEngine.Entity.Physics
get

The representation of this Entity in the physics engine.

◆ Position

Vector3 CryEngine.Entity.Position
getset

Get or set the position of the Entity in local-space.

◆ Rotation

Quaternion CryEngine.Entity.Rotation
getset

Get or set the rotation of the Entity in local-space.

◆ Scale

Vector3 CryEngine.Entity.Scale
getset

Get or set the scale of the Entity in local-space.

◆ Transform

Matrix3x4 CryEngine.Entity.Transform
getset

The local transform-matrix of this Entity.

◆ WorldPosition

Vector3 CryEngine.Entity.WorldPosition
getset

Get or set the position of the Entity in world-space.

The world position.

◆ WorldRotation

Quaternion CryEngine.Entity.WorldRotation
getset

Get or set the rotation of the Entity in world-space.

The world rotation.

  • No labels