Skyline Lua API  Version 1.0
Lua Script Reference for Skyline Game Engine.
LUA_API_Entity.h
Go to the documentation of this file.
1 // | _ ____ __ _
2 // | / \ _ _ _ __ __ _/ ___| ___ / _| |_
3 // | / _ \| | | | '__/ _` \___ \ / _ \| |_| __|
4 // | / ___ \ |_| | | | (_| |___) | (_) | _| |_
5 // | /_/ \_\__,_|_| \__,_|____/ \___/|_| \__|
6 // |
7 // | Aurasoft UK 2008 - 2018 http://www.aurasoft.co.uk
8 // |
9 // | Skyline Game Engine Lua API Documentation
10 // |
11 // | This file belongs to Aurasoft UK for the Skyline Game Engine of all versions.
12 // | This file is not for use in any other software that is not owned by Aurasoft UK and cannot be used by any other
13 // | person outside of the Skyline Game Engine development team.
14 // |
15 // | © Copyright - Aurasoft UK & Skyline Game Engine 2008 - 2018
16 // |
17 
18 // SKYLINE LUA CLASS FOR API DOCUMENTATION
19 
83 class entity
84 {
85 public:
86 
111  int spawn( string meshFilename, float posX, float posY, float posZ, float scaleX, float scaleY, float scaleZ );
112 
132  void setPosition( int entityID, float posX, float posY, float posZ);
133 
134 
151  void setPos( int entityID, Table pos);
152 
153 
176  float3 getPosition( int entityID );
177 
200  float3 getLocalPosition( int entityID );
201 
224  float3 getWorldPosition( int entityID );
225 
243  void setScale( int entityID, float scaleX, float scaleY, float scaleZ );
244 
263  float3 subtractPositions(int entityID_1, int entityID_2);
264 
290  float3 subtractPositions_float3(float x1, float y1, float z1, float x2, float y2, float z2);
291 
292 
307  void delete( int entityID );
308 
337  void addScript( int entityID, string scriptName );
338 
356  void setShadow(int entityID ,int enabledState);
357 
374  void setVisible(int entityID ,int enabledState);
375 
393  void setVisibleDistance(int entityID, float distance);
394 
412  void setStatic(int entityID, int state);
413 
434  void setRotation( int entityID, float rotX, float rotY, float rotZ );
435 
455  void roll( int entityID, float angle, int DegreeOrRadian);
456 
476  void pitch( int entityID, float angle );
477 
497  void yaw( int entityID, float angle );
498 
514  void setFixedYaw( int entityID, int check[0 or 1] );
515 
516 
537  void turn( int objID, float pitch, float yaw, float roll );
538 
559  void move( int objID, float pitch, float yaw, float roll );
560 
561 
587  float4 getRotationTo(float srcRotX, float srcRotY, float srcRotZ, float destRotX, float destRotY, float destRotZ);
588 
616  float3 getRadialOffset(int objID, float radiusOffset, float posx, float posy, float posz);
617 
637  float3 getDirection( int entityID_1, int entityID_2 );
638 
656  float3 getForward( int entityID );
657 
675  float3 getRight( int entityID );
676 
694  float3 getUp( int entityID );
695 
715  float3 getDirectionOfEntity( int entityID );
716 
734  void setDirection( int entityID, float dirX, float dirY, float dirZ );
735 
754  float4 getWorldOrientation( int entityID );
755 
778  float3 getWorldOrientationByAxis( int entityID, int axisX, int axisY, int axisZ );
779 
800  void setWorldOrientation( int entityID,int rotW, int rotX, int rotY, int rotZ );
801 
820  float4 getLocalOrientation( int entityID );
821 
844  float3 getLocalOrientationByAxis(int entityID, int axisX, int axisY, int axisZ);
845 
866  void setLocalOrientation( int entityID, int rotW, int rotX, int rotY, int rotZ );
867 
896  void lookatObject(int entityID, int targetID, float rotProgress, int axisX, int axisY, int axisZ );
897 
929  void lookatPosition( int entityID, float lookAtPosX, float lookAtPosY, float lookAtPosZ, float rotProgress, int axisX, int axisY, int axisZ);
930 
946  void setQueryFlag_DoNotSelect( int entityID );
947 
963  void setQueryFlag_Model( int entityID );
964 
984  void setQueryFlag( int entityID, int QueryFlag );
985 
1000  int getIDFromTag( string entityTagName );
1001 
1016  int getTagFromID(int entityID);
1017 
1018 
1019 
1037  int getDescription(int entityID);
1038 
1056  int setDescription(int entityID, string description);
1057 
1071  int setTag(int entityID, string tag);
1072 
1088  String getName( int objID );
1089 
1105  setName(int objID, string name);
1106 
1107 
1108 
1129  int getLastHitID();
1130 
1161  int isColliding(int objID ,float direction_x,float direction_y, float direction_z,float range,int queryflag);
1162 
1163 
1187  int exist(int entityID);
1188 
1189 
1213  void setMaterialName(int objId, string materialName);
1214 
1240  void setSubMaterialName(int objId, int subentityIndex, string materialName);
1241 
1260  void getMaterialName(int objId, int subentityIndex);
1261 
1281  int getNumSubEntities();
1282 
1308  void callPublicFn(entityID, targetID, value);
1309 
1310 
1311 
1381  void callFn(int entityID, int targetID, String functionName, String arg);
1382 
1383 
1421  void attach(int parentID, int childID);
1422 
1452  void detach(int parentID, int childID);
1453 
1454  /*FIXME*/
1455  float getElevation(int objectID, int TargetID);//get the pitch angle between the 2 objects
1456 
1460  float getHeading(int objectID, int TargetID);
1461 
1465  float getHeadingV3(int objectID, float x, float y, float z);
1466 
1470  float getSquaredDistance(int objectID, int TargetID);
1471 
1475  float getDistance(int objectID, int TargetID);
1476 
1498  float3 inverseTransform( int entityID, float x, float y, float z );
1499 
1500 
1501 
1517  entity.followPath( entityID, Pathname, Speed, (opt) useRoll);
1518 
1536  int getDistanceToVector(obj,x,y,z);
1537 
1552  int setAdvancedMaterial(id, materialname);
1553 
1569  float getBoundingSize(objID);
1570 
1571 
1587  float getBoundingRadius(objID);
1588 
1602  float getBoundingMinimum(objID);
1603 
1617  float getBoundingMaximum(objID)
1618 
1619 
1631  float getScale();
1632 
1647  float getDynamicProperty( eID, paramName )
1648 
1649 
1661  float setDynamicProperty( eID, paramName, paramValue );
1662 
1676 
1688  void rotateToSurface( eID, normalx, normaly, normalz, qw, qx, qy, qz );
1689 
1701  float distance = entity.getDistanceToCamera(objID);
1702 
1715  bool setStatic(bool state);
1716 
1729  float setVisibleDistance(float distaance);
1730 
1743  string getMeshName(objID);
1744 
1751  int registerTodEvent(int objID);
1752 
1759  int removeRegisteredTodEvent(int objID);
1760 };
1761 
1762 
1763 
1764 
1765 
1766 
1767 
1768 
1769 
1770 
1771 
1772 
1773 
1774 
1775 
void setShadow(int entityID, int enabledState)
This Function lets you cast shadows on the object you provide.
float getBoundingRadius(objID)
Get bounding box size.
float4 getLocalOrientation(int entityID)
Gets the Orientation in LOCAL Space of the entity Provided. The values returned are a Quaternion...
float getHeading(int objectID, int TargetID)
returns the yaw angle between the 2 objects
void setVisible(int entityID, int enabledState)
Set the visibility of the entity you provide.
float getBoundingMaximum(objID) float getScale()
Get bounding box maximum.
void setDirection(int entityID, float dirX, float dirY, float dirZ)
Set the Direction of an Entity by passing entitiy ID and the direction as a float3.
float3 getPosition(int entityID)
This Function will return the position of the specified Entity.
void setRotation(int entityID, float rotX, float rotY, float rotZ)
Set the Rotation of a specific scene entity.
void pitch(int entityID, float angle)
set how much to pitch a specific scene entity. This number will add to the current rotation of the en...
entity followPath(entityID, Pathname, Speed,(opt) useRoll)
Follow a path.
void setScale(int entityID, float scaleX, float scaleY, float scaleZ)
Set the Scale of the Entity with the id of entityID.
float3 getDirection(int entityID_1, int entityID_2)
Simple and Fast Function for getting the Direction between two entities. It Simply subtracts the mai...
int getDescription(int entityID)
Get a description from an entity ID.
float3 getRight(int entityID)
Get the Right direction of the specified object based on orientation.
float3 subtractPositions(int entityID_1, int entityID_2)
This Function will provide the means to subtract one entity position from another entity...
void lookatPosition(int entityID, float lookAtPosX, float lookAtPosY, float lookAtPosZ, float rotProgress, int axisX, int axisY, int axisZ)
Similar to the lookatObject Function, except this looks at a position which could be moving or stati...
void setPosition(int entityID, float posX, float posY, float posZ)
This Function will let you set the given position of the given Entity with the id of entityID...
int removeRegisteredTodEvent(int objID)
Removes this object from the tod system and will no longer receive any tod event messages.
float getBoundingMinimum(objID)
Get bounding box minimum.
int getLastHitID()
Returns the ID of the last object hit with the ray cast system.
String getName(int objID)
Get the scene list name of the entity with the passed objID arg.
float3 getRadialOffset(int objID, float radiusOffset, float posx, float posy, float posz)
Returns a poitional vector for an offset down the forward direction.
void turn(int objID, float pitch, float yaw, float roll)
Set the relative rotations of a specific scene entity.
int setDescription(int entityID, string description)
Set a description to an entity.
float paramName
Definition: LUA_API_Entity.h:1661
void entity refreshDynamicProperties()
Refresh dynamic properties.
float3 getLocalOrientationByAxis(int entityID, int axisX, int axisY, int axisZ)
Gets the Orientation in LOCAL Space of the entity Provided Multiplied by an axis. This allows you to...
int isColliding(int objID, float direction_x, float direction_y, float direction_z, float range, int queryflag)
Returns the value 1 if this ray collides with an object.
float getSquaredDistance(int objectID, int TargetID)
returns the distance between the 2 objects but less accurate and faster then getDistance() ...
float paramValue
Definition: LUA_API_Entity.h:1661
int getDistanceToVector(obj, x, y, z)
Position to vector.
void setQueryFlag_Model(int entityID)
Set the Query flag for MODEL_MASK. Once an entity has had this mask applied, it will be INCLUDED in ...
void callPublicFn(entityID, targetID, value)
Call this command to trigger an event in the target entities script.
float3 getWorldOrientationByAxis(int entityID, int axisX, int axisY, int axisZ)
Gets the Orientation in WORLD Space of the entity Provided Multiplied by an axis. This allows you to...
string getMeshName(objID)
get mesh name distance from object to camera.
int setAdvancedMaterial(id, materialname)
Set material to advanced.
void setMaterialName(int objId, string materialName)
Call this command to set the material name of all sub materials.
int exist(int entityID)
Returns the value 1 if the entity ID pass in the arg exists in the scene.
float3 getLocalPosition(int entityID)
This will return the local position of the specified entity based on its parents node position...
float distance
get distance to camera distance from object to camera.
Definition: LUA_API_Entity.h:1701
float getBoundingSize(objID)
Get bounding box size.
float3 getWorldPosition(int entityID)
This Function will return the world position of the specified Entity whether it is attached or not...
int setTag(int entityID, string tag)
Set a tag name for the object.
void callFn(int entityID, int targetID, String functionName, String arg)
Use entity.callFn(...) to call any function in any objects script, a direct script ot script communic...
float3 getForward(int entityID)
Get the Forward direction of the specified object based on orientation.
void setStatic(int entityID, int state)
Set the visibility distance of the entity of entityID.
int getTagFromID(int entityID)
Get a Tag name from an entity ID.
float getHeadingV3(int objectID, float x, float y, float z)
returns the yaw angle between the object and the provided position x,y,z
setName(int objID, string name)
Set the scene list name of the entity with the passed objID arg.
Definition: LUA_API_States.h:28
void setVisibleDistance(int entityID, float distance)
Set the visibility distance of the entity of entityID.
float3 inverseTransform(int entityID, float x, float y, float z)
transforms a world space position to local position based on node orientation. This essentially makes...
void setSubMaterialName(int objId, int subentityIndex, string materialName)
Call this command to set the material name of the specified sub entity.
int registerTodEvent(int objID)
Add this Object to the Time Of Day system so that its script can receive atod event. Great to turn on/off the lights at night.
void setPos(int entityID, Table pos)
This Function will let you set the position of an Entity with the id of entityID by pass in a table f...
void setLocalOrientation(int entityID, int rotW, int rotX, int rotY, int rotZ)
Set the LOCAL Orientation of the entity you provide to the function.
float3 getDirectionOfEntity(int entityID)
Simple and Fast Function for getting the direction of an entity without needing 2 ids or positions It...
int getIDFromTag(string entityTagName)
Get the ID of the Entity from its Entity Tag.
void attach(int parentID, int childID)
This function will allow you to attach a "sceneEntity" or "dynamic sceneEntity"(spawned) to another e...
float4 getWorldOrientation(int entityID)
Gets the Orientation in WORLD Space of the entity Provided. The values returned are a Quaternion...
void getMaterialName(int objId, int subentityIndex)
Call this command to get the material name of the sub entity passed through.
int getNumSubEntities()
Call this command to get the number of sub entity the sceneEntity has.
void setQueryFlag(int entityID, int QueryFlag)
Set the Query flag for this object to the value pass in the second argument "QueryFlag".
void move(int objID, float pitch, float yaw, float roll)
Move the specified object in the XYZ direction by the unit amounts passed in the argument.
void lookatObject(int entityID, int targetID, float rotProgress, int axisX, int axisY, int axisZ)
Simple Function to make one entity lookat another entity.
void roll(int entityID, float angle, int DegreeOrRadian)
set how much to roll a specific scene entity. This number will add to the current rotation of the ent...
float getDynamicProperty(eID, paramName) float setDynamicProperty(eID
getDynamicProperty
float4 getRotationTo(float srcRotX, float srcRotY, float srcRotZ, float destRotX, float destRotY, float destRotZ)
Gets the shortest arc quaternion to rotate this vector to the destination vector. This can be used t...
float getElevation(int objectID, int TargetID)
void setWorldOrientation(int entityID, int rotW, int rotX, int rotY, int rotZ)
Set the WORLD Orientation of the entity you provide to the function.
void yaw(int entityID, float angle)
Set the Yaw of a specific scene entity.
void setQueryFlag_DoNotSelect(int entityID)
Set the Query flag for DO_NOT_SELECT_MASK. Once an entity has had this mask applied, it will be EXCLUDED in ray casts to objects.
void detach(int parentID, int childID)
This function will allow you to detach a "sceneEntity" or "dynamic sceneEntity"(spawned) from another...
void addScript(int entityID, string scriptName)
This Function will Add a script referenced by scriptName to an entity with the id of entityID...
void rotateToSurface(eID, normalx, normaly, normalz, qw, qx, qy, qz)
Rortate to surface Rotate an entity to align with the surface of a physics object.
void setFixedYaw(int entityID, int check[0 or 1])
Fixes an entity to only rotate around the Y Axis, this will stop quaternion rotations from rolling...
float getDistance(int objectID, int TargetID)
returns the distance between the 2 objects
float3 getUp(int entityID)
Get the UP direction of the specified object based on orientation.
int spawn(string meshFilename, float posX, float posY, float posZ, float scaleX, float scaleY, float scaleZ)
This Function will spawn a new scene entity model with the provided meshFilename, position and scale...
Definition: LUA_API_Entity.h:83
float3 subtractPositions_float3(float x1, float y1, float z1, float x2, float y2, float z2)
This function provides the means to subtract 1 float3 from another float3, useful for getting directi...