Enfusion Script API
|
Public Member Functions | |
proto external EntityID | GetID () |
Return unique entity ID. | |
proto external IEntity | GetParent () |
Returns parent of this entity (entity on upper level of hierarchy). | |
proto external IEntity | GetRootParent () |
Returns top-parent of this entity. | |
proto external IEntity | GetChildren () |
Returns first child from this level of hierarchy if there is any. | |
proto external IEntity | GetSibling () |
Returns next sibling of this entity (next entity on this level of hierarchy). | |
proto external VObject | GetVObject () |
Returns visual object set to this Entity. No reference is added. | |
proto external EntityPrefabData | GetPrefabData () |
proto external EntityComponentPrefabData | FindComponentData (TypeName typeName) |
proto external BaseWorld | GetWorld () |
proto external void | SetFixedLOD (int lod) |
Set fixed LOD. Use -1 for non-fixed LOD. | |
proto external void | GetTransform (out vector mat[]) |
Returns world transformation of Entity. | |
proto external void | GetWorldTransform (out vector mat[]) |
See IEntity::GetTransform. | |
proto external void | GetLocalTransform (out vector mat[]) |
See IEntity::GetTransform. | |
proto external vector | VectorToParent (vector vec) |
Transforms local vector to parent(world) space. | |
proto external vector | CoordToParent (vector coord) |
Transforms local position to parent(world) space. | |
proto external vector | VectorToLocal (vector vec) |
Transforms world space vector to local space. | |
proto external vector | CoordToLocal (vector coord) |
Transforms world space position to local space. | |
proto external vector | GetYawPitchRoll () |
Returns orientation of Entity in world space (Yaw, Pitch, Roll). | |
proto external void | SetYawPitchRoll (vector angles) |
Sets angles for entity (Yaw, Pitch, Roll). | |
proto external vector | GetWorldTransformAxis (int axis) |
See IEntity::GetTransformAxis. | |
proto external vector | GetTransformAxis (int axis) |
See IEntity::GetTransformAxis. | |
proto external vector | GetLocalTransformAxis (int axis) |
See IEntity::GetTransformAxis. | |
proto external bool | SetLocalTransform (vector mat[4]) |
See IEntity::SetTransform. Returns false , if there is no change in transformation. | |
proto external bool | SetWorldTransform (vector mat[4]) |
See IEntity::SetTransform. Returns false , if there is no change in transformation. | |
proto external TNodeId | GetPivot () |
Returns pivot ID from hierarchy component. | |
proto external bool | SetTransform (vector mat[4]) |
Sets entity world transformation. | |
proto external vector | GetLocalAngles () |
Same as GetLocalYawPitchRoll(), but returns rotation vector around X, Y and Z axis. | |
proto external vector | GetLocalYawPitchRoll () |
Returns local orientation when it's in hierarchy (Yaw, Pitch, Roll). | |
proto external vector | GetAngles () |
Same as GetYawPitchRoll(), but returns rotation vector around X, Y and Z axis. | |
proto external void | SetAngles (vector angles) |
Same as SetYawPitchRoll(), but sets rotation around X, Y and Z axis. | |
proto external vector | GetOrigin () |
Returns origin of Entity. | |
proto external void | SetOrigin (vector orig) |
Sets origin for entity. | |
proto external void | SetScale (float scale) |
proto external float | GetScale () |
proto external void | GetBounds (out vector mins, out vector maxs) |
Returns local bounding box of model on Entity. | |
proto external void | GetWorldBounds (out vector mins, out vector maxs) |
Returns quantized world-bound-box of Entity. | |
proto external volatile void | SendEvent (notnull IEntity actor, EntityEvent e, void extra) |
Dynamic event invocation. Parameters are the same as in IEntity::EOnXXXX() methods. | |
proto external string | GetName () |
proto external int | SetVComponentFlags (VCFlags flags) |
Sets component flags. | |
proto external void | SetObject (VObject object, string options) |
Sets the visual object to this entity. | |
proto external EntityFlags | SetFlags (EntityFlags flags, bool recursively=false) |
Sets Entity flags. | |
proto external EntityFlags | ClearFlags (EntityFlags flags, bool recursively=false) |
Clear Entity flags. | |
proto external EntityFlags | GetFlags () |
Returns Entity flags. | |
proto external EntityEvent | SetEventMask (EntityEvent e) |
Sets event mask. | |
proto external EntityEvent | ClearEventMask (EntityEvent e) |
Clears event mask. | |
proto external EntityEvent | GetEventMask () |
Returns current event mask. | |
proto external bool | IsLoaded () |
proto external bool | IsRemoved () |
proto external bool | IsDeleted () |
proto external int | Update () |
Updates entity state/position. | |
proto external int | AddChild (notnull IEntity child, TNodeId pivot, EAddChildFlags flags=EAddChildFlags.AUTO_TRANSFORM) |
Add Entity to hierarchy. Pivot is pivot index, or -1 for center of parent. | |
proto external void | RemoveChild (notnull IEntity child, bool keepTransform=false) |
Remove Entity from hierarchy. | |
proto external void | SetName (string name) |
proto external int | SetCameraMask (int mask) |
Sets visibility mask for cameras, where Entity will be rendered. | |
proto external Physics | GetPhysics () |
proto external Particles | GetParticles () |
proto external Animation | GetAnimation () |
proto external int | Animate (float speed, int loop) |
Updates animation (either xob, or particle, whatever). | |
proto external int | AnimateEx (float speed, int loop, out vector lin, out vector ang) |
Updates animation (either xob, or particle, whatever). | |
proto external void | SetBone (TNodeId bone, vector angles, vector trans, float scale) |
proto external bool | SetBoneMatrix (TNodeId bone, vector mat[4]) |
proto external bool | GetBoneMatrix (TNodeId bone, out vector mat[4]) |
proto external TNodeId | GetBoneIndex (string boneName) |
proto external void | GetBoneNames (out notnull array< string > boneNames) |
proto external bool | GetBoneLocalMatrix (TNodeId bone, out vector mat[4]) |
proto external Managed | FindComponent (TypeName typeName) |
Finds first occurance of the coresponding component. | |
proto external int | FindComponents (TypeName typeName, notnull array< Managed > outComponents) |
Finds all occurances of the coresponding component. | |
Public Member Functions inherited from Managed | |
proto external ref Managed | Clone () |
Return shallow copy of object, or null if it is not allowed (not public constructor) | |
Protected Member Functions | |
void | EOnTouch (IEntity owner, IEntity other, int touchTypesMask) |
Event when touched by other entity. | |
void | EOnInit (IEntity owner) |
Event after entity is allocated and initialized. | |
void | EOnVisible (IEntity owner, int frameNumber) |
Event when we are visible. | |
void | EOnFrame (IEntity owner, float timeSlice) |
Event every frame. | |
void | EOnPostFrame (IEntity owner, float timeSlice) |
Event after physics update. | |
void | EOnAnimEvent (IEntity owner, int type, int slot) |
Event from animation system. | |
void | EOnSimulate (IEntity owner, float timeSlice) |
Event before every physics fixed step (can be multiple calls per engine update) | |
void | EOnPostSimulate (IEntity owner, float timeSlice) |
Event after every physics fixed step (can be multiple calls per engine update) | |
void | EOnJointBreak (IEntity owner, IEntity other) |
Event when joint attached to RigidBody of this entity is broken. | |
void | EOnPhysicsMove (IEntity owner) |
Event when physics engine has moved with this Entity. | |
void | EOnContact (IEntity owner, IEntity other, Contact contact) |
Event when physics engine registered contact with other RigidBody. | |
void | EOnPhysicsActive (IEntity owner, bool activeState) |
Event when a RigidBody active state is changed between consecutive fixed steps. | |
void | EOnFixedFrame (IEntity owner, float timeSlice) |
Event every fixed frame. | |
void | EOnFixedPostFrame (IEntity owner, float timeSlice) |
Event after physics update every fixed frame. | |
void | EOnUser0 (IEntity other, int extra) |
EntityEvent.EV_USER+0. | |
void | EOnUser1 (IEntity other, int extra) |
EntityEvent.EV_USER+1. | |
void | EOnUser2 (IEntity other, int extra) |
EntityEvent.EV_USER+2. | |
void | EOnUser3 (IEntity other, int extra) |
EntityEvent.EV_USER+3. | |
void | EOnUser4 (IEntity other, int extra) |
EntityEvent.EV_USER+4. | |
void | IEntity (IEntitySource src, IEntity parent) |
protected script Constructor | |
|
protected |
protected script Constructor
proto external int IEntity.AddChild | ( | notnull IEntity | child, |
TNodeId | pivot, | ||
EAddChildFlags | flags = EAddChildFlags.AUTO_TRANSFORM |
||
) |
Add Entity to hierarchy. Pivot is pivot index, or -1 for center of parent.
Updates animation (either xob, or particle, whatever).
Updates animation (either xob, or particle, whatever).
proto external EntityEvent IEntity.ClearEventMask | ( | EntityEvent | e | ) |
Clears event mask.
e | event mask |
proto external EntityFlags IEntity.ClearFlags | ( | EntityFlags | flags, |
bool | recursively = false |
||
) |
Clear Entity flags.
Returns cleared flags.
flags | Flags to be set |
recursively | Flags will be recursively applied to children of hierarchy too |
Transforms world space position to local space.
coord | world space position to transform |
Transforms local position to parent(world) space.
coord | local position to transform |
Event from animation system.
owner | The owner entity |
type | |
slot |
Event when physics engine registered contact with other RigidBody.
owner | The owner entity |
other | Other Entity who contacted us |
contact | Structure describing the contact |
Event every fixed frame.
owner | The owner entity |
timeSlice | Fixed time step |
Implemented in RplExample3Controller.
Event after physics update every fixed frame.
owner | The owner entity |
timeSlice | Fixed time step |
Event every frame.
owner | The owner entity |
timeSlice | Time passed since last frame |
Implemented in AutotestGrid, FPS_Autotest, MotionAutoTest, Screenshot_Autotest, EntityWithRplRpc, RplExampleDebugShape, and RplExample3Controller.
|
protected |
Event after entity is allocated and initialized.
owner | The owner entity |
Implemented in AutotestGrid, FPS_Autotest, MotionZone, MotionAutoTest, Screenshot_Autotest, CrossroadEntity, and WorldDecal.
Event when joint attached to RigidBody of this entity is broken.
owner | The owner entity |
other | Other Entity attached to the joint |
Event when a RigidBody active state is changed between consecutive fixed steps.
owner | The owner entity |
|
protected |
Event when physics engine has moved with this Entity.
owner | The owner entity |
Event after physics update.
owner | The owner entity |
timeSlice | Time passed since last frame |
Implemented in ScriptCamera.
Event after every physics fixed step (can be multiple calls per engine update)
owner | The owner entity |
timeSlice | Time slice of physics fixed step |
Event before every physics fixed step (can be multiple calls per engine update)
owner | The owner entity |
timeSlice | Time slice of physics fixed step |
Event when touched by other entity.
owner | The owner entity |
other | Entity who touched us |
touchTypesMask | Bitmask of touch types TODO |
Event when we are visible.
owner | The owner entity |
frameNumber | Frame number |
Finds first occurance of the coresponding component.
typeName | type of the component |
proto external EntityComponentPrefabData IEntity.FindComponentData | ( | TypeName | typeName | ) |
proto external int IEntity.FindComponents | ( | TypeName | typeName, |
notnull array< Managed > | outComponents | ||
) |
Finds all occurances of the coresponding component.
typeName | type of the component |
outComponents | array to fill with selected components |
proto external vector IEntity.GetAngles | ( | ) |
Same as GetYawPitchRoll(), but returns rotation vector around X, Y and Z axis.
proto external Animation IEntity.GetAnimation | ( | ) |
proto external IEntity IEntity.GetChildren | ( | ) |
Returns first child from this level of hierarchy if there is any.
proto external EntityEvent IEntity.GetEventMask | ( | ) |
Returns current event mask.
proto external EntityFlags IEntity.GetFlags | ( | ) |
Returns Entity flags.
proto external EntityID IEntity.GetID | ( | ) |
Return unique entity ID.
proto external vector IEntity.GetLocalAngles | ( | ) |
Same as GetLocalYawPitchRoll(), but returns rotation vector around X, Y and Z axis.
proto external void IEntity.GetLocalTransform | ( | out vector | mat[] | ) |
proto external vector IEntity.GetLocalYawPitchRoll | ( | ) |
Returns local orientation when it's in hierarchy (Yaw, Pitch, Roll).
proto external string IEntity.GetName | ( | ) |
proto external vector IEntity.GetOrigin | ( | ) |
Returns origin of Entity.
proto external IEntity IEntity.GetParent | ( | ) |
Returns parent of this entity (entity on upper level of hierarchy).
proto external Particles IEntity.GetParticles | ( | ) |
proto external Physics IEntity.GetPhysics | ( | ) |
proto external TNodeId IEntity.GetPivot | ( | ) |
Returns pivot ID from hierarchy component.
proto external EntityPrefabData IEntity.GetPrefabData | ( | ) |
proto external IEntity IEntity.GetRootParent | ( | ) |
Returns top-parent of this entity.
proto external float IEntity.GetScale | ( | ) |
proto external IEntity IEntity.GetSibling | ( | ) |
Returns next sibling of this entity (next entity on this level of hierarchy).
proto external void IEntity.GetTransform | ( | out vector | mat[] | ) |
Returns world transformation of Entity.
It returns only as many vectors as is array length.
mat | vector[1...4] matrix to be get |
proto external VObject IEntity.GetVObject | ( | ) |
Returns visual object set to this Entity. No reference is added.
proto external BaseWorld IEntity.GetWorld | ( | ) |
Returns quantized world-bound-box of Entity.
[out] | mins | minimum point of bounding box |
[out] | maxs | maximum point of bounding box |
proto external void IEntity.GetWorldTransform | ( | out vector | mat[] | ) |
proto external vector IEntity.GetYawPitchRoll | ( | ) |
Returns orientation of Entity in world space (Yaw, Pitch, Roll).
proto external bool IEntity.IsDeleted | ( | ) |
true
if entity was deleted (entity pointer valid until the end of the frame). proto external bool IEntity.IsLoaded | ( | ) |
true
when entity is loaded from map, false
when dynamically spawned. proto external bool IEntity.IsRemoved | ( | ) |
true
if entity is ready to be deleted. Remove Entity from hierarchy.
proto external volatile void IEntity.SendEvent | ( | notnull IEntity | actor, |
EntityEvent | e, | ||
void | extra | ||
) |
Dynamic event invocation. Parameters are the same as in IEntity::EOnXXXX()
methods.
proto external void IEntity.SetAngles | ( | vector | angles | ) |
Same as SetYawPitchRoll(), but sets rotation around X, Y and Z axis.
Sets visibility mask for cameras, where Entity will be rendered.
proto external EntityEvent IEntity.SetEventMask | ( | EntityEvent | e | ) |
Sets event mask.
e | Combined mask of one or more members of EntityEvent enum |
proto external void IEntity.SetFixedLOD | ( | int | lod | ) |
Set fixed LOD. Use -1 for non-fixed LOD.
proto external EntityFlags IEntity.SetFlags | ( | EntityFlags | flags, |
bool | recursively = false |
||
) |
Sets Entity flags.
It's OR operation, not rewrite. Returns previous flags.
flags | Flags to be set |
recursively | Flags will be recursively applied to children of hierarchy too |
See IEntity::SetTransform. Returns false
, if there is no change in transformation.
proto external void IEntity.SetName | ( | string | name | ) |
Sets the visual object to this entity.
Reference is added and released upon entity destruction.
object | Handle to object got by GetObject(). |
options | String, dependent on object type. The only one supported for XOB objects: "$remap 'original material name' 'new material'; [$remap 'another original material name' 'another new material']" |
proto external void IEntity.SetOrigin | ( | vector | orig | ) |
Sets origin for entity.
orig | origin to be set |
proto external void IEntity.SetScale | ( | float | scale | ) |
See IEntity::SetTransform. Returns false
, if there is no change in transformation.
proto external void IEntity.SetYawPitchRoll | ( | vector | angles | ) |
Sets angles for entity (Yaw, Pitch, Roll).
angles | angles to be set |
proto external int IEntity.Update | ( | ) |
Updates entity state/position.
Should be called when you want to manually commit position changes etc before trace methods etc. Entity is updated automatically at the end and the beginning of simulation step, when it has EntityFlags.TFL_ACTIVE flag set.
Transforms world space vector to local space.
vec | world space vector to transform |
Transforms local vector to parent(world) space.
vec | local space vector to transform |