Class Actor
Base class for all actor objects on the scene.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Level/Actor.h
Syntax
public class Actor : public SceneObject
Constructors
DEPRECATED("Use AddTag instead") void SetTag(const StringView& value)
Sets the name of the tag. [Deprecated in v1.5]
Declaration
public DEPRECATED("Use AddTag instead") void SetTag(const StringView& value)
Parameters
"Use Add
|
DEPRECATED("Use HasTag instead") const String& GetTag()
Gets the name of the tag. [Deprecated in v1.5]
Declaration
public DEPRECATED("Use HasTag instead") const String& GetTag() const
Parameters
"Use Has
|
Fields
_box
_drawCategory
Declaration
protected uint16 _drawCategory
Field Value
uint16
|
_drawNoCulling
Declaration
protected uint16 _drawNoCulling
Field Value
uint16
|
_isActive
Declaration
protected uint16 _isActive
Field Value
uint16
|
_isActiveInHierarchy
Declaration
protected uint16 _isActiveInHierarchy
Field Value
uint16
|
_isEnabled
Declaration
protected uint16 _isEnabled
Field Value
uint16
|
_isHierarchyDirty
Declaration
protected uint16 _isHierarchyDirty
Field Value
uint16
|
_isPrefabRoot
Declaration
protected uint16 _isPrefabRoot
Field Value
uint16
|
_layer
Declaration
protected byte _layer
Field Value
byte
|
_localTransform
_name
_physicsScene
_scene
_sphere
_staticFlags
_transform
Children
List with all child actors attached to the actor (readonly). All items are valid (not null).
Declaration
public Array<Actor* > Children
Field Value
Array<Actor >
|
HideFlags
Scripts
List with all scripts attached to the actor (readonly). All items are valid (not null).
Declaration
public Array<Script* > Scripts
Field Value
Array<Script >
|
Tags
Actor tags collection.
Declaration
public Array<Tag> Tags
Field Value
Array<Tag>
|
Methods
AddMovement(const Vector3& translation)
Moves the actor (also can rotate it) in world space.
Declaration
public void AddMovement(const Vector3& translation)
Parameters
Vector3
translation
The translation vector. |
Returns
void
|
AddMovement(const Vector3& translation, const Quaternion& rotation)
Moves the actor (also can rotate it) in world space.
Declaration
public virtual void AddMovement(const Vector3& translation, const Quaternion& rotation)
Parameters
Vector3
translation
The translation vector. |
Quaternion
rotation
The rotation quaternion. |
AddScript()
Creates a new script of a specific type and adds it to the actor.
Declaration
public T* AddScript()
Returns
T
The created script instance, null otherwise. |
Type Parameters
typename T
|
AddStaticFlags(StaticFlags flags)
Adds the actor static flags.
Declaration
public void AddStaticFlags(StaticFlags flags)
Parameters
Static The flags to add. |
Returns
void
|
AddTag(const Tag& tag)
Adds a tag to the actor
Declaration
public void AddTag(const Tag& tag)
Parameters
Tag
tag
The tag to add. |
AddTagRecursive(const Tag& tag)
Adds a tag to the actor and for all underlying child actors.
Declaration
public void AddTagRecursive(const Tag& tag)
Parameters
Tag
tag
The tag to add. |
BeginPlay(SceneBeginData* data)
Called when adding object to the game.
Declaration
public virtual void BeginPlay(SceneBeginData* data) override
Parameters
Scene The initialization data (e.g. used to collect joints to link after begin). |
Overrides
BreakPrefabLink()
Breaks the prefab linkage for this object, all its scripts, and all child actors.
Declaration
public virtual void BreakPrefabLink() override
Overrides
ChangeScriptOrder(Script* script, int32 newIndex)
Changes the script order.
Declaration
public void ChangeScriptOrder(Script* script, int32 newIndex)
Parameters
Script
script
The script. |
int32
newIndex
The new index. |
Clone()
Clones actor including all scripts and any child actors (whole scene tree). Objects are duplicated via serialization (any transient/non-saved state is ignored).
Declaration
public Actor* Clone()
Returns
Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
Deserializes object from the input stream.
Declaration
public virtual void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override
Parameters
Deserialize The input stream. |
ISerialize The deserialization modifier object. Always valid. |
Overrides
DestroyChildren(float timeLeft = 0.0f)
Destroys the children. Calls Object.Destroy on every child actor and unlinks them for this actor.
Declaration
public void DestroyChildren(float timeLeft = 0.0f)
Parameters
float
timeLeft
The time left to destroy object (in seconds). |
Draw(RenderContext& renderContext)
Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. geometry is rendered during all pass types but other actors are drawn only during GBufferFill pass).
Declaration
public virtual void Draw(RenderContext& renderContext)
Parameters
Render The rendering context. |
Draw(RenderContextBatch& renderContextBatch)
Draws this actor. Called by Scene Rendering service. This call is more optimized than generic Draw (eg. geometry is rendered during all pass types but other actors are drawn only during GBufferFill pass).
Declaration
public virtual void Draw(RenderContextBatch& renderContextBatch)
Parameters
Render The rendering context batch (eg, main view and shadow projections). |
EndPlay()
Called when removing object from the game.
Declaration
public virtual void EndPlay() override
Overrides
FindActor()
Tries to find the actor of the given type in this actor hierarchy (checks this actor and all children hierarchy).
Declaration
public T* FindActor() const
Returns
T
Actor instance if found, null otherwise. |
Type Parameters
typename T
|
FindActor(const MClass* type, bool activeOnly=false)
Tries to find the actor of the given type in this actor hierarchy (checks this actor and all children hierarchy).
Declaration
public Actor* FindActor(const MClass* type, bool activeOnly=false) const
Parameters
MClass
type
Type of the actor to search for. Includes any actors derived from the type. Supports interface types. |
bool
activeOnly
Finds only a active actor. |
Returns
Actor
Actor instance if found, null otherwise. |
FindActor(const MClass* type, const StringView& name)
Tries to find the actor of the given type and name in this actor hierarchy (checks this actor and all children hierarchy).
Declaration
public Actor* FindActor(const MClass* type, const StringView& name) const
Parameters
MClass
type
Type of the actor to search for. Includes any actors derived from the type. Supports interface types. |
String The name of the actor. |
Returns
Actor
Actor instance if found, null otherwise. |
FindActor(const MClass* type, const Tag& tag, bool activeOnly=false)
Tries to find the actor of the given type and tag in this actor hierarchy.
Declaration
public Actor* FindActor(const MClass* type, const Tag& tag, bool activeOnly=false) const
Parameters
MClass
type
Type of the actor to search for. Includes any actors derived from the type. Supports interface types. |
Tag
tag
The tag of the actor to search for. |
bool
activeOnly
Finds only an active actor. |
Returns
Actor
Actor instance if found, null otherwise. |
FindActor(const StringView& name)
Tries to find the actor with the given name in this actor hierarchy (checks this actor and all children hierarchy).
Declaration
public Actor* FindActor(const StringView& name) const
Parameters
String The name of the actor. |
Returns
Actor
Actor instance if found, null otherwise. |
FindActor(const Tag& tag)
Tries to find the actor of the given type and tag in this actor hierarchy (checks this actor and all children hierarchy).
Declaration
public T* FindActor(const Tag& tag) const
Parameters
Tag
tag
The tag of the actor to search for. |
Returns
T
Actor instance if found, null otherwise. |
Type Parameters
typename T
|
FindScript()
Tries to find the script of the given type in this actor hierarchy (checks this actor and all children hierarchy).
Declaration
public T* FindScript() const
Returns
T
Script instance if found, null otherwise. |
Type Parameters
typename T
|
FindScript(const MClass* type)
Tries to find the script of the given type in this actor hierarchy (checks this actor and all children hierarchy).
Declaration
public Script* FindScript(const MClass* type) const
Parameters
MClass
type
Type of the actor to search for. Includes any actors derived from the type. Supports interface types. |
Returns
Script
Script instance if found, null otherwise. |
FromBytes(const Span<byte>& data)
Performs actors deserialization from the raw bytes.
Declaration
public static Array<Actor* > FromBytes(const Span<byte>& data)
Parameters
Span<byte>
data
The input data. |
Returns
Array<Actor >
The output actors. |
FromBytes(const Span<byte>& data, Array<Actor* >& output, ISerializeModifier* modifier)
Performs actors deserialization from the raw bytes.
Declaration
public static bool FromBytes(const Span<byte>& data, Array<Actor* >& output, ISerializeModifier* modifier)
Parameters
Span<byte>
data
The input data. |
Array<Actor >
output
The output actors. |
ISerialize The custom serialization modifier. |
Returns
bool
True if fails, otherwise false. |
FromBytes(const Span<byte>& data, const Dictionary<Guid, Guid, HeapAllocation>& idsMapping)
Performs actors deserialization from the raw bytes.
Declaration
public static Array<Actor* > FromBytes(const Span<byte>& data, const Dictionary<Guid, Guid, HeapAllocation>& idsMapping)
Parameters
Span<byte>
data
The input data. |
Dictionary<Guid, Guid, HeapAllocation>
idsMapping
The serialized objects Ids mapping. Can be used to convert the spawned objects ids and references to them. |
Returns
Array<Actor >
The output actors. |
FromJson(const StringAnsiView& json)
Deserializes the actor object to the Json string. Deserialized are only this actor properties but no child actors nor scripts.
Declaration
public void FromJson(const StringAnsiView& json)
Parameters
String The serialized actor data (state). |
GetBox()
Gets actor bounding box that defines 3D space intersecting with the actor (for determination of the visibility for actor).
Declaration
public BoundingBox GetBox() const
Returns
GetBoxWithChildren()
Gets actor bounding box of the actor including all child actors (children included in recursive way)
Declaration
public BoundingBox GetBoxWithChildren() const
Returns
GetChild()
Gets the child actor of the given type.
Declaration
public T* GetChild() const
Returns
T
The child actor or null. |
Type Parameters
typename T
|
GetChild(const MClass* type)
Gets the child actor of the given type.
Declaration
public Actor* GetChild(const MClass* type) const
Parameters
MClass
type
Type of the actor to search for. Includes any actors derived from the type. Supports interface types. |
Returns
Actor
The child actor or null. |
GetChild(const StringView& name)
Gets the child actor with the given name.
Declaration
public Actor* GetChild(const StringView& name) const
Parameters
String The child actor name. |
Returns
Actor
The child actor or null. |
GetChild(int32 index)
Gets the child actor at the given index.
Declaration
public Actor* GetChild(int32 index) const
Parameters
int32
index
The child actor index. |
Returns
Actor
The child actor (always valid). |
GetChildren()
Gets the child actors of the given type.
Declaration
public Array<T* > GetChildren() const
Returns
Array<T >
The child actors. |
Type Parameters
typename T
|
GetChildren(const MClass* type)
Gets the child actors of the given type.
Declaration
public Array<Actor* > GetChildren(const MClass* type) const
Parameters
MClass
type
Type of the actor to search for. Includes any actors derived from the type. Supports interface types. |
Returns
Array<Actor >
The child actors. |
GetChildrenCount()
Gets amount of child actors.
Declaration
public int32 GetChildrenCount() const
Returns
int32
|
GetDirection()
Gets actor direction vector (forward vector).
Declaration
public Float3 GetDirection() const
Returns
Float3
|
GetEditorBox()
Gets actor bounding box (single actor, no children included) for editor tools.
Declaration
public virtual BoundingBox GetEditorBox() const
Returns
GetEditorBoxChildren()
Gets actor bounding box of the actor including all child actors for editor tools.
Declaration
public BoundingBox GetEditorBoxChildren() const
Returns
GetIsActive()
Gets value indicating if actor is active in the scene.
Declaration
public bool GetIsActive() const
Returns
bool
|
GetLayer()
Gets the object layer (index). Can be used for selective rendering or ignoring raycasts.
Declaration
public int32 GetLayer() const
Returns
int32
|
GetLayerMask()
Gets the layer mask (with single bit set).
Declaration
public int32 GetLayerMask() const
Returns
int32
|
GetLayerName()
GetLocalOrientation()
Gets local rotation of the actor in parent actor space.
Declaration
public Quaternion GetLocalOrientation() const
Returns
GetLocalPosition()
Gets local position of the actor in parent actor space.
Declaration
public Vector3 GetLocalPosition() const
Returns
Vector3
|
GetLocalScale()
Gets local scale vector of the actor in parent actor space.
Declaration
public Float3 GetLocalScale() const
Returns
Float3
|
GetLocalToWorldMatrix(Double4x4& localToWorld)
Gets the matrix that transforms a point from the local space of the actor to world space.
Declaration
public void GetLocalToWorldMatrix(Double4x4& localToWorld) const
Parameters
Double4x4
localToWorld
The world to local matrix. |
GetLocalToWorldMatrix(Matrix& localToWorld)
Gets the matrix that transforms a point from the local space of the actor to world space.
Declaration
public void GetLocalToWorldMatrix(Matrix& localToWorld) const
Parameters
Matrix
localToWorld
The world to local matrix. |
GetLocalTransform()
Gets local transform of the actor in parent actor space.
Declaration
public Transform GetLocalTransform() const
Returns
GetName()
GetOrAddChild()
Finds the child actor of the given type or creates a new one.
Declaration
public T* GetOrAddChild()
Returns
T
The child actor. |
Type Parameters
typename T
|
GetOrderInParent()
Gets zero-based index in parent actor children list (scripts or child actors).
Declaration
public virtual int32 GetOrderInParent() const override
Returns
int32
The order in parent. |
Overrides
GetOrientation()
Gets actor orientation in 3D space
Declaration
public Quaternion GetOrientation() const
Returns
GetPerInstanceRandom()
Gets the random per-instance value (normalized to range 0-1).
Declaration
public float GetPerInstanceRandom() const
Returns
float
|
GetPhysicsScene()
Get the physics world the controller is part of.
Declaration
public PhysicsScene* GetPhysicsScene() const
Returns
GetPosition()
Gets the actor's world transform position.
Declaration
public Vector3 GetPosition() const
Returns
Vector3
|
GetPrefabRoot()
Gets the root of the prefab this actor is attached to.
Declaration
public Actor* GetPrefabRoot()
Returns
Actor
The root prefab object, or null if this actor is not a prefab. |
GetRotation()
GetScale()
Gets actor scale in 3D space.
Declaration
public Float3 GetScale() const
Returns
Float3
|
GetScene()
Gets the scene object which contains this actor.
Declaration
public Scene* GetScene() const
Returns
GetSceneObjectId()
Gets the scene object ID.
Declaration
public virtual Guid GetSceneObjectId() const override
Returns
Guid
The scene object ID. |
Overrides
GetSceneRendering()
Gets the scene rendering object.
Declaration
public SceneRendering* GetSceneRendering() const
Returns
Scene The scene rendering interface. |
GetScript()
Gets the script of the given type from this actor.
Declaration
public T* GetScript() const
Returns
T
The script or null. |
Type Parameters
typename T
|
GetScript(const MClass* type)
Gets the script of the given type from this actor.
Declaration
public Script* GetScript(const MClass* type) const
Parameters
MClass
type
Type of the script to search for. Includes any scripts derived from the type. Supports interface types. |
Returns
Script
The script or null. |
GetScript(int32 index)
Gets the script at the given index.
Declaration
public Script* GetScript(int32 index) const
Parameters
int32
index
The script index. |
Returns
Script
The script (always valid). |
GetScriptByID(const Guid& id)
Gets the script by its identifier.
Declaration
public Script* GetScriptByID(const Guid& id) const
Parameters
Guid
id
The script identifier. |
Returns
Script
The script or null. |
GetScripts()
Gets the scripts of the given type from this actor.
Declaration
public Array<T* > GetScripts() const
Returns
Array<T >
The scripts. |
Type Parameters
typename T
|
GetScripts(const MClass* type)
Gets the scripts of the given type from this actor.
Declaration
public Array<Script* > GetScripts(const MClass* type) const
Parameters
MClass
type
Type of the script to search for. Includes any scripts derived from the type. Supports interface types. |
Returns
Array<Script >
The scripts. |
GetScriptsCount()
Gets amount of scripts.
Declaration
public int32 GetScriptsCount() const
Returns
int32
|
GetSphere()
Gets actor bounding sphere that defines 3D space intersecting with the actor (for determination of the visibility for actor).
Declaration
public BoundingSphere GetSphere() const
Returns
GetStaticFlags()
Gets the actor static flags.
Declaration
public StaticFlags GetStaticFlags() const
Returns
GetTransform()
Gets the actor's world transformation.
Declaration
public Transform GetTransform() const
Returns
GetWorldToLocalMatrix(Double4x4& worldToLocal)
Gets the matrix that transforms a point from the world space to local space of the actor.
Declaration
public void GetWorldToLocalMatrix(Double4x4& worldToLocal) const
Parameters
Double4x4
worldToLocal
The world to local matrix. |
GetWorldToLocalMatrix(Matrix& worldToLocal)
Gets the matrix that transforms a point from the world space to local space of the actor.
Declaration
public void GetWorldToLocalMatrix(Matrix& worldToLocal) const
Parameters
Matrix
worldToLocal
The world to local matrix. |
HasActorInChildren(Actor* a)
Try to find actor in child actors structure.
Declaration
public bool HasActorInChildren(Actor* a) const
Parameters
Actor
a
The actor to find. |
Returns
bool
Found actor or null. |
HasActorInHierarchy(Actor* a)
Try to find actor in hierarchy structure.
Declaration
public bool HasActorInHierarchy(Actor* a) const
Parameters
Actor
a
The actor to find. |
Returns
bool
Found actor or null. |
HasContentLoaded()
Returns true if actor has loaded content.
Declaration
public virtual bool HasContentLoaded() const
Returns
bool
|
HasScene()
Gets value indicating if actor is in a scene.
Declaration
public bool HasScene() const
Returns
bool
|
HasStaticFlag(StaticFlags flag)
Returns true if object has given flag(s) set.
Declaration
public bool HasStaticFlag(StaticFlags flag) const
Parameters
Static
|
Returns
bool
|
HasTag()
Determines whether this actor has any tag assigned.
Declaration
public bool HasTag() const
Returns
bool
|
HasTag(const StringView& tag)
Determines whether this actor has given tag assigned (exact match).
Declaration
public bool HasTag(const StringView& tag) const
Parameters
String The tag to check. |
Returns
bool
|
HasTag(const Tag& tag)
Determines whether this actor has given tag assigned (exact match).
Declaration
public bool HasTag(const Tag& tag) const
Parameters
Tag
tag
The tag to check. |
Returns
bool
|
Initialize()
Called after object loading or spawning to initialize the object (eg. call OnAwake for scripts) but before BeginPlay. Initialization should be performed only within a single SceneObject (use BeginPlay to initialize with a scene).
Declaration
public virtual void Initialize() override
Overrides
InitializeHierarchy()
Calls Initialize for all objects in the actor hierarchy.
Declaration
public void InitializeHierarchy()
Intersects(const Ray& ray, Real& distance, Vector3& normal)
Determines if there is an intersection between the current object or any it's child and a ray.
Declaration
public Actor* Intersects(const Ray& ray, Real& distance, Vector3& normal)
Parameters
Ray
ray
The ray to test. |
Real
distance
When the method completes, contains the distance of the intersection (if any valid). |
Vector3
normal
When the method completes, contains the intersection surface normal vector (if any valid). |
Returns
Actor
The target hit actor that is the closest to the ray. |
IntersectsItself(const Ray& ray, Real& distance, Vector3& normal)
Determines if there is an intersection between the current object and a ray.
Declaration
public virtual bool IntersectsItself(const Ray& ray, Real& distance, Vector3& normal)
Parameters
Ray
ray
The ray to test. |
Real
distance
When the method completes, contains the distance of the intersection (if any valid). |
Vector3
normal
When the method completes, contains the intersection surface normal vector (if any valid). |
Returns
bool
True whether the two objects intersected, otherwise false. |
IsActiveInHierarchy()
Gets value indicating if actor is active in the scene graph. It must be active as well as that of all it's parents.
Declaration
public bool IsActiveInHierarchy() const
Returns
bool
|
IsPrefabRoot()
Gets a value indicating whether this actor is a prefab instance root object.
Declaration
public bool IsPrefabRoot() const
Returns
bool
|
IsStatic()
Returns true if object is fully static on the scene, otherwise false.
Declaration
public bool IsStatic() const
Returns
bool
|
IsTransformStatic()
Returns true if object has static transform.
Declaration
public bool IsTransformStatic() const
Returns
bool
|
LinkPrefab(const Guid& prefabId, const Guid& prefabObjectId)
Links scene object instance to the prefab asset and prefab object. Warning! This applies to the only this object (not scripts or child actors).
Declaration
public virtual void LinkPrefab(const Guid& prefabId, const Guid& prefabObjectId) override
Parameters
Overrides
LookAt(const Vector3& worldPos)
Rotates actor to orient it towards the specified world position.
Declaration
public void LookAt(const Vector3& worldPos)
Parameters
Vector3
worldPos
The world position to orient towards. |
LookAt(const Vector3& worldPos, const Vector3& worldUp)
Rotates actor to orient it towards the specified world position with upwards direction.
Declaration
public void LookAt(const Vector3& worldPos, const Vector3& worldUp)
Parameters
Vector3
worldPos
The world position to orient towards. |
Vector3
worldUp
The up direction that constrains up axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel. |
LookingAt(const Vector3& worldPos)
Gets rotation of the actor oriented towards the specified world position.
Declaration
public Quaternion LookingAt(const Vector3& worldPos) const
Parameters
Vector3
worldPos
The world position to orient towards. |
Returns
LookingAt(const Vector3& worldPos, const Vector3& worldUp)
Gets rotation of the actor oriented towards the specified world position with upwards direction.
Declaration
public Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const
Parameters
Vector3
worldPos
The world position to orient towards. |
Vector3
worldUp
The up direction that constrains up axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel. |
Returns
OnActiveChanged()
Called when actor active state gets changed.
Declaration
public virtual void OnActiveChanged()
OnActiveInTreeChanged()
Called when actor active in tree state gets changed.
Declaration
public virtual void OnActiveInTreeChanged()
OnBeginPlay()
Called when adding object to the game.
Declaration
public virtual void OnBeginPlay()
OnDebugDraw()
Draws debug shapes for the actor and all child scripts.
Declaration
public virtual void OnDebugDraw()
OnDebugDrawSelected()
Draws debug shapes for the selected actor and all child scripts.
Declaration
public virtual void OnDebugDrawSelected()
OnDeleteObject()
Deletes the object. Called by the ObjectsRemovalService. Can be overriden to provide custom logic per object (cleanup, etc.).
Declaration
public virtual void OnDeleteObject() override
Overrides
OnDisable()
Called when actor gets removed from game systems. Occurs on EndPlay event or when actor gets inactivated in hierarchy. Use this event to unregister object from other game system (eg. audio).
Declaration
public virtual void OnDisable()
OnEnable()
Called when actor gets added to game systems. Occurs on BeginPlay event or when actor gets activated in hierarchy. Use this event to register object to other game system (eg. audio).
Declaration
public virtual void OnEnable()
OnEndPlay()
Called when removing object from the game.
Declaration
public virtual void OnEndPlay()
OnLayerChanged()
Called when layer gets changed.
Declaration
public virtual void OnLayerChanged()
OnOrderInParentChanged()
Called when order in parent children array gets changed.
Declaration
public virtual void OnOrderInParentChanged()
OnParentChanged()
Called when actor parent gets changed.
Declaration
public virtual void OnParentChanged()
OnPhysicsSceneChanged(PhysicsScene* previous)
Declaration
protected virtual void OnPhysicsSceneChanged(PhysicsScene* previous)
Parameters
Physics
|
OnStaticFlagsChanged()
Called when actor static flag gets changed.
Declaration
public virtual void OnStaticFlagsChanged()
OnTransformChanged()
Called when actor transform gets changed.
Declaration
public virtual void OnTransformChanged()
RemoveStaticFlags(StaticFlags flags)
Removes the actor static flags.
Declaration
public void RemoveStaticFlags(StaticFlags flags)
Parameters
Static The flags to remove. |
Returns
void
|
RemoveTag(const Tag& tag)
Removes a tag to the actor
Declaration
public void RemoveTag(const Tag& tag)
Parameters
Tag
tag
The tag to remove. |
ResetLocalTransform()
Resets the actor local transform.
Declaration
public void ResetLocalTransform()
Serialize(SerializeStream& stream, const void* otherObj)
Serializes object to the output stream compared to the values of the other object instance (eg. default class object). If other object is null then serialize all properties.
Declaration
public virtual void Serialize(SerializeStream& stream, const void* otherObj) override
Parameters
Serialize The output stream. |
void
otherObj
The instance of the object to compare with and serialize only the modified properties. If null, then serialize all properties. |
Overrides
SetDirection(const Float3& value)
Sets actor direction vector (forward)
Declaration
public void SetDirection(const Float3& value)
Parameters
Float3
value
The value to set. |
SetIsActive(bool value)
Sets value indicating if actor is active in the scene.
Declaration
public virtual void SetIsActive(bool value)
Parameters
bool
value
The value to set. |
SetLayer(int32 layerIndex)
Sets the layer.
Declaration
public void SetLayer(int32 layerIndex)
Parameters
int32
layerIndex
The index of the layer. |
SetLayerName(const StringView& value)
Sets the name of the layer.
Declaration
public void SetLayerName(const StringView& value)
Parameters
String
|
SetLayerNameRecursive(const StringView& value)
Sets the name of the layer recursively for actor and for all underlying child actors.
Declaration
public void SetLayerNameRecursive(const StringView& value)
Parameters
String
|
SetLayerRecursive(int32 layerIndex)
Sets the layer recursively for all underlying children.
Declaration
public void SetLayerRecursive(int32 layerIndex)
Parameters
int32
layerIndex
The index of the layer. |
SetLocalOrientation(const Quaternion& value)
Sets local rotation of the actor in parent actor space.
Declaration
public void SetLocalOrientation(const Quaternion& value)
Parameters
Quaternion
value
The value to set. |
SetLocalPosition(const Vector3& value)
Sets local position of the actor in parent actor space.
Declaration
public void SetLocalPosition(const Vector3& value)
Parameters
Vector3
value
The value to set. |
SetLocalScale(const Float3& value)
Sets local scale vector of the actor in parent actor space.
Declaration
public void SetLocalScale(const Float3& value)
Parameters
Float3
value
The value to set. |
SetLocalTransform(const Transform& value)
Sets local transform of the actor in parent actor space.
Declaration
public void SetLocalTransform(const Transform& value)
Parameters
Transform
value
The value to set. |
SetName(const StringView& value)
Sets the actor name.
Declaration
public void SetName(const StringView& value)
Parameters
String The value to set. |
SetName(String&& value)
Sets the actor name.
Declaration
public void SetName(String&& value)
Parameters
String
value
The value to set. |
SetOrderInParent(int32 index)
Sets zero-based index in parent actor children list (scripts or child actors).
Declaration
public virtual void SetOrderInParent(int32 index) override
Parameters
int32
index
The new order in parent. |
Overrides
SetOrientation(const Quaternion& value)
Sets actor orientation in 3D space.
Declaration
public void SetOrientation(const Quaternion& value)
Parameters
Quaternion
value
The value to set. |
SetParent(Actor* value, bool canBreakPrefabLink=true)
Sets the parent actor.
Declaration
public virtual void SetParent(Actor* value, bool canBreakPrefabLink=true) override
Parameters
Actor
value
The new parent. |
bool
canBreakPrefabLink
True if can break prefab link on changing the parent. |
Overrides
SetParent(Actor* value, bool worldPositionsStays, bool canBreakPrefabLink)
Sets a actor parent.
Declaration
public void SetParent(Actor* value, bool worldPositionsStays, bool canBreakPrefabLink)
Parameters
Actor
value
New parent |
bool
worldPositionsStays
Should actor world positions remain the same after parent change? |
bool
canBreakPrefabLink
True if can break prefab link on changing the parent. |
SetPhysicsScene(PhysicsScene* scene)
Set the physics world the controller is part of.
Declaration
public void SetPhysicsScene(PhysicsScene* scene)
Parameters
Physics
|
SetPosition(const Vector3& value)
Sets the actor's world transform position.
Declaration
public void SetPosition(const Vector3& value)
Parameters
Vector3
value
The value to set. |
SetRotation(const Matrix& value)
Sets actor rotation matrix.
Declaration
public void SetRotation(const Matrix& value)
Parameters
Matrix
value
The value to set. |
SetScale(const Float3& value)
Sets actor scale in 3D space
Declaration
public void SetScale(const Float3& value)
Parameters
Float3
value
The value to set. |
SetStaticFlag(StaticFlags flag, bool value)
Sets a single static flag to the desire value.
Declaration
public void SetStaticFlag(StaticFlags flag, bool value)
Parameters
Static The flag to change. |
bool
value
The target value of the flag. |
Returns
void
|
SetStaticFlags(StaticFlags value)
Sets the actor static flags.
Declaration
public virtual void SetStaticFlags(StaticFlags value)
Parameters
Static The value to set. |
SetTransform(const Transform& value)
Sets the actor's world transformation.
Declaration
public void SetTransform(const Transform& value)
Parameters
Transform
value
The value to set. |
ToBytes(const Array<Actor* >& actors)
Performs actors serialization to the raw bytes.
Declaration
public static Array<byte> ToBytes(const Array<Actor* >& actors)
Parameters
Array<Actor >
actors
The actors to serialize. |
Returns
Array<byte>
The output data, empty if failed. |
ToBytes(const Array<Actor* >& actors, MemoryWriteStream& output)
Performs actors serialization to the raw bytes.
Declaration
public static bool ToBytes(const Array<Actor* >& actors, MemoryWriteStream& output)
Parameters
Array<Actor >
actors
The actors to serialize. |
Memory The output data stream. |
Returns
bool
True if fails, otherwise false. |
ToJson()
Serializes the actor object to the Json string. Serialized are only this actor properties but no child actors nor scripts. Serializes references to the other objects in a proper way using IDs.
Declaration
public String ToJson()
Returns
String
The Json container with serialized actor data. |
ToString()
Gets the string representation of this object.
Declaration
public virtual String ToString() const override
Returns
Overrides
TreeExecute(Function<bool(Actor* , Params ...)>& action, Params ... args)
Execute custom action on actors tree.
Declaration
public void TreeExecute(Function<bool(Actor* , Params ...)>& action, Params ... args)
Parameters
Function<bool(Actor , Params ...)>
action
Actor to call on every actor in the tree. Returns true if keep calling deeper. |
Params ...
args
Custom arguments for the function |
Type Parameters
Params
|
TreeExecuteChildren(Function<bool(Actor* , Params ...)>& action, Params ... args)
Execute custom action on actor children tree.
Declaration
public void TreeExecuteChildren(Function<bool(Actor* , Params ...)>& action, Params ... args)
Parameters
Function<bool(Actor , Params ...)>
action
Actor to call on every actor in the tree. Returns true if keep calling deeper. |
Params ...
args
Custom arguments for the function |
Type Parameters
Params
|
TryGetSerializedObjectsIds(const Span<byte>& data)
Tries the get serialized objects ids from the raw bytes.
Declaration
public static Array<Guid> TryGetSerializedObjectsIds(const Span<byte>& data)
Parameters
Span<byte>
data
The data. |
Returns
Array<Guid>
The output array of serialized object ids. |
UnregisterObjectHierarchy()
Calls UnregisterObject for all objects in the actor hierarchy.
Declaration
public void UnregisterObjectHierarchy()