S2ENGINE HD  1.4.6
Official manual about S2Engine HD editor and programming
ScriptFunctions.h
Go to the documentation of this file.
1 
9 
34 bool Bool(float f);
35 bool Bool(int i);
36 bool Bool(string s);
54 float Float(string s);
55 float Float(int i);
73 int Int(string s);
74 int Int(float f);
116 string String(float f);
117 string String(bool b);
118 string String(int i);
119 string String(vec3 v3);
120 string String(vec4 v4);
132  var vec3 v;
133  var string s;
134  s="0.0,1.0,0.0";
135  v=string2vec3(s);
136  \endcode
137 */
138 vec3 String2Vec3(string s);
150  var vec4 v;
151  var string s;
152  s="0.0,1.0,10.0,5.0";
153  v=string2vec4(s);
154  \endcode
155 */
156 vec4 String2Vec4(string s);
167 vec3 Vec3(float x, float y, float z);
179 vec4 Vec4(float x, float y, float z, float w);
181 
185 
195 bool GetSubWidgetFlag(string sw, string flag);
223 void CreateWidget(string class,string script,string params,string pos);
233 void CreateHUD(string script);
257 void CreateHUDWidget(string class,string script,string params,string pos);
268 void DestroySubWidget(string widget);
282 string GetSubWidgetParam(string widget, string param);
296  ResetSubWidgetFlags("button01","w_grayed");
297  \endcode
298 
299  \see GetFlag, GetSubWidgetFlag, SetSubWidgetFlags
300 */
301 void ResetSubWidgetFlag(string sw, string flags);
315  SetSubWidgetFlags("button01","w_grayed");
316  \endcode
317 
318  \see GetFlag, GetSubWidgetFlag, ResetSubWidgetFlags
319 */
320 void SetSubWidgetFlag(string sw, string flags);
336 void SetSubWidgetOpacity(string widget, float opacity);
351 void SetSubWidgetParam(string widget, string param, string value);
366 void SetSubWidgetPos(string widget, float x, float y);
378 void SetWidgetOpacity(float opacity);
387 void ShowCursor(bool show);
400 void ShowParentWidget(bool show);
416 void ShowSubWidget(string widget, bool show);
430 void ShowWidget(bool show);
432 
436 
456 void PhysicsCreateCharacter(float slopeLimit);
476 void PhysicsCreateBody(string coltype, float mass, vec3 props);
501  PhysicsCreateVehicle("carBody","wheel01,wheel02","wheel03,wheel04","200,11000,5000,7,0.05,10,-95");
502  \endcode
503 */
504 void PhysicsCreateVehicle(string vehicleBody, string frontWheels, string backWheels, string props);
517 bool PhysicsCollisionTest(float radius, vec3 start, vec3 end);
529 void PhysicsVehicleControl(float steerAngle, float acc, bool handbrake);
560 void PhysicsApplyForce(vec3 point, vec3 dir, float len);
561 void PhysicsApplyForce(vec3 point, string axis, float len);
597 void PhysicsApplyDirForceToRagdoll(vec3 dir, float len);
598 void PhysicsApplyDirForceToRagdoll(string axis, float len);
627 void PhysicsApplyForceToNode(string node, vec3 point, vec3 dir, float len);
628 void PhysicsApplyForceToNode(string node, vec3 point, string axis, float len);
660 void PhysicsApplyForceToObject(string obj, vec3 point, vec3 dir, float len);
661 void PhysicsApplyForceToObject(string obj, vec3 point, string axis, float len);
695 void PhysicsApplyForceToRagdoll(vec3 point, vec3 dir, float len);
696 void PhysicsApplyForceToRagdoll(vec3 point, string axis, float len);
707 void PhysicsApplyGravity(bool apply);
722 bool PhysicsCharacterCollisionTest(string obj, vec3 start, vec3 end);
734 void PhysicsCharacterMove(vec3 dir, float disp);
755 void PhysicsCreateRagdoll();
774 string PhysicsGetCollidedObject();
786 bool PhysicsGetCollideFlag();
803 vec3 PhysicsGetObjectPos();
812 float PhysicsGetVehicleRPM();
828 bool PhysicsNodeCollisionTest(string obj, string node, float radius, vec3 disp);
854 void PhysicsObjectSleep();
865 void PhysicsObjectWakeUp();
874 void PhysicsRagdollSleep();
883 void PhysicsRagdollWakeUp();
917 void PhysicsSetCharacterDims(vec3 dims);
931 void PhysicsSetCharacterGravity(float gravity);
944 void PhysicsSetCollideFlag();
955 void PhysicsSetObjectPos(vec3 pos);
967 
971 
981 float Abs(float scalar);
992 float Min(float a, float b);
1003 float Max(float a, float b);
1016  var float num;
1017  num=10.0;
1018  num=Clamp(0.0,1.0);
1019  LOG("num="+string(num));
1020 
1021  /* RESULT */
1022  num=1.0
1023  \endcode
1024  \see Abs,Min,Max
1025 */
1026 float Clamp(float scalar, float min, float max);
1037 vec3 CrossProduct(vec3 v1, vec3 v2);
1048 float DotProduct(vec3 v1, vec3 v2);
1058 vec3 NormalizeV(vec3 v);
1068 float Cos(float angle);
1078  var float a;
1079  a=Rand(5000);
1080  \endcode
1081 */
1082 float Rand(int res);
1095 float ScalarInterpolate(float s1, float s2, float t);
1108  var vec3 p0;
1109  var vec3 p1;
1110  p0=GetMousePos();
1111 
1112  p0.z=0.0; /* this point is near the screen */
1113  p1=p0;
1114  p1.z=99999.0 /* this point is very far from screen */
1115 
1116  /* project these two points into 3d world space */
1117  p0=ScreenToWorld(p0);
1118  p1=ScreenToWorld(p1);
1119 
1120  /* ray cast */
1121  RayPick(p0,p1-p0,1.0);
1122 
1123  /* Get picked object */
1124  var string pickObj;
1125  pickObj=GetPickObject();
1126  \endcode
1127 
1128  \see WorldToScreen
1129 */
1130 vec3 ScreenToWorld(vec3 p);
1140 float Sin(float angle);
1153 vec3 VectorInterpolate(vec3 s1, vec3 s2, float t);
1164 float VectorLen(vec3 v);
1178 vec3 VectorRotate(vec3 v, float angle, vec3 axis);
1194 vec3 VectorToAngles(vec3 v); /* Get Object Pippo World Pos */
1207  var vec3 pos;
1208  pos=GetObjectWorldPos("pippo");
1209 
1210  /* Compute screen pos of pippo world pos */
1211  var vec3 screenPos;
1212  screenPos=WorldToScreen(pos);
1213 
1214  /* Set widget pos */
1215  SetParam("pos",screenPos);
1216  \endcode
1217 
1218  \see ScreenToWorld
1219 */
1220 vec3 WorldToScreen(vec3 p);
1222 
1226 
1240 void CrossFadeMusic(string music, int channel);
1253 void PlayMusic(string music, int channel);
1267 void PlaySound(string sound, bool loop);
1281 void PlaySoundGlobal(string sound, bool loop);
1296 void SetSource(float gain, float range);
1310 void SetSourcePitch(float pitch);
1322 void SetSourceRange(float range);
1334 void SetSourceVolume(float volume);
1345 void StopMusic(int channel);
1354 void StopSound();
1363 void StopSoundGlobal();
1372 bool IsSoundPlaying();
1374 
1378 
1393 void AICreateCharacter(float radius, float height, string maxLinear, string maxAngular);
1408 void AICreateObject(bool isObstacle, bool isOccluder, float radius, float height);
1420 void AIEnableHearing(bool enable, float range);
1433 void AIEnableVision(bool enable, string eyeNode, float range);
1444 void FindPath(vec3 target);
1460 vec3 AIGetFurthestCoverPoint(vec3 opponent, vec3 target, float range);
1475 vec3 AIGetNearestAllowedPoint(vec3 target, float range);
1491 vec3 AIGetNearestCoverPoint(vec3 opponent, vec3 target, float range);
1504 string AIGetNearestHeardObject();
1522 vec3 AIGetNearestTacticalCoverPoint(vec3 opponent, vec3 target, float range, int ID);
1539 vec3 AIGetNearestTacticalPatrolPoint(vec3 target, float range, int ID);
1548 string AIGetNearestViewedObject();
1560 bool AIObjectIsHeard(string obj);
1572 bool AIObjectIsViewed(string obj);
1581 bool AIPointIsInsideWaypointArea(vec3 point);
1595 void AISetCharacterMaxAngular(float acc, float speed);
1609 void AISetCharacterMaxLinear(float acc, float speed);
1622 void AISetSteeringWeight(string steer, float weight);
1637 void AISetTargetToFacePos(vec3 target);
1652 void AISetTargetToReachPos(vec3 target);
1654 
1658 
1668 bool GetInputAction(string name);
1680 float GetInputAxis(string name);
1908 bool IsKeyPressed(string key, int mode);
1916 vec3 GetMousePos();
1924 vec3 GetMouseRelPos();
1941 string GetPressedKey(int mode);
1943 
1947 
1957 void LOG(string str);
1965 int GetNumVideoModes();
1981 string GetVideoMode(int i);
1988 void CloseLevel();
2000 bool LoadLevel(string level);
2007 void Exit();
2016 void EnginePause();
2023 void EngineResume();
2032 string GetAudioDevice(int i);
2043 string GetEngineParam(string param);
2061 string GetLevelParam(string param);
2068 int GetNumAudioDevice();
2081 string Load(string path);
2115  LoadResource("Pippo/prova.tga","level");
2116 
2117  /* this is the WRONG example */
2118  LoadResource("Texture/Pippo/prova.tga","level");
2119 
2120  /* this is also WRONG */
2121  LoadResource("S2EngineHD/Texture/Pippo/prova.tga","level");
2122  \endcode
2123 */
2124 void LoadResource(string resPath, string cache);
2133 void RestartLevel();
2145 void Save(string text, string path);
2157 void SetEngineParam(string param, string value);
2169 void SetLevelParam(string param, string value);
2182  SetTimeScale(2.0);
2183  \endcode
2184 */
2185 void SetTimeScale(float timeMul);
2187 
2191 
2202 int AddAnimationChannel();
2215 void AddAnimationToChannel(int channel, string animName);
2232 void SetAnimationBlendX(int channel, string animName, float value);
2249 void SetAnimationBlendY(int channel, string animName, float value);
2265 void AnimationCrossFade(int channel, string animName, float time);
2281 void AnimationChannelFadeIn(int channel, float time);
2297 void AnimationChannelFadeOut(int channel, float time);
2307 void BlendAnimationChannel(int channel, float weight);
2324 void BlendCurrentAnimation(string anim, float weight, int channel);
2337 void PauseAnimation(int channel);
2351  BlendCurrentAnimation("idle",1.0,0);
2352 
2353  /* Play channel 0 animations in loop, in this case only 'idle' */
2354  PlayAnimation(true,0);
2355  \endcode
2356 
2358 */
2359 void PlayAnimation(int channel, bool loop);
2373 void SetAnimationChannelMask(int channel, string maskname);
2383 void SetAnimationChannelSpeed(int channel, float speed);
2396 void StopAnimation(int channel);
2407 bool IsAnimationStopped(int channel);
2409 
2413 
2425 void SetParam(string param, string value);
2436 string GetParam(string param);
2448 void ActiveObject(string objname, vec3 pos, vec3 angles);
2461 void AttachObject(string obj, string node, vec3 pos, vec3 angles);
2472 void SpawnObject(string prefabFilename, vec3 pos, vec3 angles);
2482 void SetObjectFlags(string objname, string flags);
2492 void ResetObjectFlags(string objname, string flags);
2504 bool GetObjectFlag(string objname, string flag);
2517 string GetObjectParam(string objname, string paramname, bool isStock);
2530 string SetObjectParam(string objname, string paramname, string paramvalue);
2543 string GetObjectScriptParam(string objname, string paramname, bool isStock);
2554 vec3 GetObjectWorldPos(string objname);
2564 vec3 GetObjectWorldAxis(string objname, string axis);
2573 vec3 GetObjectWorldAngles(string objname);
2582 vec3 GetWorldAxis(string axis);
2591 vec3 GetAxis(string axis);
2593 
2597 
2603 
2626 void SendMessageSingle(string dest, string name, string content);
2627 void SendMessageSingle(string dest, string name, string content, float delay);
2650 void SendMessageBroad(string dest, string name, string content);
2651 void SendMessageBroad(string dest, string name, string content, float delay);
2676 void SendMessageMulti(string name, string content, float range, string class);
2677 void SendMessageMulti(string name, string content, float range, float delay);
2698 void SendMessageGUI(string name, string content);
2699 void SendMessageGUI(string name, string content, float delay);
2720 void SendMessageHUD(string name, string content);
2721 void SendMessageHUD(string name, string content, float delay);
2730 bool ReceivedMessage(string msg);
2732 
2736 
2739 
2740 
2741 
2742 
2743 
2744 
int AddAnimationChannel()
This function Adds an animation channel to the animation channel list of an entity.
void CrossFadeMusic(string music, int channel)
This function play a music on a given channel by fading in it and fading out all mucis playing on the...
bool AIObjectIsHeard(string obj)
This function returns true if an object is heard by this object.
vec3 GetObjectWorldPos(string objname)
This function returns the worldspace position of an object.
void PhysicsCreateCharacter()
This function creates a character into the physics subsystem and associates it to this object...
string AIGetNearestHeardObject()
This function returns the name of the nearest object heard by this object.
vec4 Vec4(float x, float y, float z, float w)
This function returns a 4d vector given 4 float numbers as input. It is useful to build a vec4 from 4...
float Cos(float angle)
This function returns the cosine value of a given angle. The angle value is expressed in degrees...
void PhysicsApplyForce(vec3 point, vec3 dir, float len)
This function applies a force to this object if it has a physics object associated.
void PhysicsVehicleControl(float steerAngle, float acc, bool handbrake)
This function moves this object if it is associated with a physics vehicle.
float Float(string s)
This function convert an integer, or a string value into a float value.
vec3 GetAxis(string axis)
This function returns one of the 3 axis of THIS object (object owning the script) orthonormal basis i...
void SetParam(string param, string value)
This function sets the value of a specified param of this object if this is an object script or this ...
void SetObjectFlags(string objname, string flags)
This function sets to TRUE all input flags of an object.
string GetObjectParam(string objname, string paramname, bool isStock)
This function returns the value of the parameter of an object as string. Every object has its own par...
vec3 WorldToScreen(vec3 p)
This function transforms a point from world coordinates space to screen coordinates space...
string GetSubWidgetParam(string widget, string param)
This function returns a param value of child widget of this widget, if it exists. ...
void SetSubWidgetOpacity(string widget, float opacity)
This function sets the opacity level of the tree starting from the child widget of this widget...
void SetSubWidgetFlag(string sw, string flags)
This function sets (to true) the flags of a widget that is a child of this one.
float Clamp(float scalar, float min, float max)
This function returns the clamped value of an input float number between a nim and a max value...
void SendMessageSingle(string dest, string name, string content)
This function send a message to a single active object given its name.
void AnimationChannelFadeOut(int channel, float time)
This function starts the 'fade Out' transition of an animation channel.
float Max(float a, float b)
This function returns the maximum value between two given float values.
void AISetTargetToFacePos(vec3 target)
This function sets the target point that AI character must to face using Steering behaviors...
bool ReceivedMessage(string msg)
This is a special function that has effect only inside the Message() main function. It returns true if the message msg has been received.
vec3 AIGetNearestTacticalPatrolPoint(vec3 target, float range, int ID)
This function returns the nearest point from a given point( also called the target point) in which th...
void ResetSubWidgetFlag(string sw, string flags)
This function resets( sets to false) the flags of a widget that is a child of this one...
float Min(float a, float b)
This function returns the minimum value between two given float values.
void PhysicsCreateRagdoll()
This function creates a Ragdoll basing on this object model format.
float VectorLen(vec3 v)
This function returns the Length of a 3d vector.
void SendMessageGUI(string name, string content)
This function sends a message to the main widget of the GUI.
vec3 GetObjectWorldAxis(string objname, string axis)
This function returns one of the 3 axis of object orthonormal basis in worldspace.
void PhysicsCharacterMove(vec3 dir, float disp)
This function moves this object if it is associated with a physics character. By default, gravity is applied on the characters movement. You can use PhysicsSetCharacterGravity function to enable/disable the gravity applied on the characters.
vec3 AIGetNearestAllowedPoint(vec3 target, float range)
This function returns the nearest point (nearest to a given 'target point') toward which the characte...
void SetAnimationChannelSpeed(int channel, float speed)
This function sets the overall speed of an animation channel.
void AttachObject(string obj, string node, vec3 pos, vec3 angles)
This function activates a stock object and puts it into this object hierarchy (the attached object wi...
void PhysicsCreateBody(string coltype, float mass, vec3 props)
This function creates a physics rigid body and associates it to 'this object'.
bool GetObjectFlag(string objname, string flag)
This function returns the value (TRUE or FALSE) of an object flag.
void SetEngineParam(string param, string value)
This function sets the value of a specified param of the engine and its subsystems: Render...
string GetLevelParam(string param)
This function returns the value of a specified param of the current scene.
void AISetCharacterMaxAngular(float acc, float speed)
This function sets the maximum angular accelleration and maximum angular velocity of this object if i...
vec3 VectorInterpolate(vec3 s1, vec3 s2, float t)
This function returns the result of the linear interpolation between two input 3d Vectors...
string GetEngineParam(string param)
This function returns the value of a specified param of the engine and its subsystems: render...
vec3 NormalizeV(vec3 v)
This function returns a normalized 3d vector.
void SetSubWidgetParam(string widget, string param, string value)
This function assigns a value to a param of child widget of this widget, if it exists.
bool AIPointIsInsideWaypointArea(vec3 point)
This function returns true if a give point is inside a WaypointArea.
void AIEnableVision(bool enable, string eyeNode, float range)
This function makes AI subsystem enable Vision feature for this object AI.
void SetSourceVolume(float volume)
This function sets the sound source volume.
void LoadResource(string resPath, string cache)
This function loads a resource given its filename.
void SetAnimationBlendX(int channel, string animName, float value)
This function assigns a blend float value to a blended animation in X direction.
void PhysicsObjectWakeUp()
This functions sets the state of the body associated with this object to wake up. ...
void ShowSubWidget(string widget, bool show)
This function shows/hides a child of this widget given its name.
void PhysicsApplyForceToNode(string node, vec3 point, vec3 dir, float len)
This function applies a force to a node of this object. This function has effect only if the object n...
bool PhysicsNodeCollisionTest(string obj, string node, float radius, vec3 disp)
This function executes the Sweep test of an object node using a capsule builded from the node and the...
void PlayMusic(string music, int channel)
This function play a music on a given channel.
vec3 ScreenToWorld(vec3 p)
This function transforms a point from screen coordinates space to world coordinates space...
bool IsAnimationStopped(int channel)
This function returns true if the specified animation channel isn't playing. Otherwise it returns fal...
void SetTimeScale(float timeMul)
This function sets the simulation time speed multiplier.
string GetObjectScriptParam(string objname, string paramname, bool isStock)
This function returns the value of the parameter of the object script as string.
void SetSourcePitch(float pitch)
This function sets the sound source pitch.
string GetPressedKey(int mode)
This function returns the pressed key, if there is one. Otherwise it returns null. There are 3 ways in which the keyboard key pression can be detected:
float Rand(int res)
This function returns a float random number between 0.0 and 1.0 given the number of all possible choi...
void SendMessageHUD(string name, string content)
This function sends a message to the main widget of the HUD.
void BlendAnimationChannel(int channel, float weight)
This function sets the blend weight value of an animation channel given its ID number.
void PhysicsCharacterToRagdoll()
This function stops all animation channels, wakeUp the ragdoll associated with This Object...
void PhysicsApplyForceToRagdoll(vec3 point, vec3 dir, float len)
This function applies a force to an object if it has a physics object associated. The object is ident...
void StopSound()
This function stops a sound playing on this object source.
void SetWidgetOpacity(float opacity)
This function sets the opacity level of the tree starting from this widget.
int GetNumAudioDevice()
This function returns the number of audio devices supported by the hardware system.
bool Bool(float f)
This function convert an integer, a float, or a string value into a boolean value.
void PhysicsSetCharacterGravity(float gravity)
This function sets the amount of the gravity applied on the physics character associated with this ob...
vec3 String2Vec3(string s)
This function convert a string into a 3d vector.
bool GetSubWidgetFlag(string sw, string flag)
This function returns the flag value (true or false) of a widget that is a child of this one...
void Exit()
This function shutdown the engine and exit from the application.
void PhysicsApplyForceToObject(string obj, vec3 point, vec3 dir, float len)
This function applies a force to an object if it has a physics object associated. The object is ident...
void AnimationChannelFadeIn(int channel, float time)
This function starts the 'fade in' transition of an animation channel.
void PlaySound(string sound, bool loop)
This function plays a sound given its filename.
void PhysicsApplyGravity(bool apply)
This function sets to true/false the gravity application on the physics object associated to this obj...
void AICreateObject(bool isObstacle, bool isOccluder, float radius, float height)
This function creates an object for the AI subsystem.
void ShowWidget(bool show)
This function shows/hides this widget.
void SetLevelParam(string param, string value)
This function sets the value of a specified param of the current scene.
void Save(string text, string path)
This function saves a string into a text file.
void CreateWidget(string class, string script, string params, string pos)
This function creates a GUI element (Widget). A widget can be a button, label, a dialog, a frame, etc.
string Load(string path)
This function loads a text file and returns its content as a string.
void AICreateCharacter(float radius, float height, string maxLinear, string maxAngular)
This function creates a character for the AI subsystem.
void PhysicsSetCharacterDims(vec3 dims)
This function sets the dimensions of the capsule of a physics character associated to this object...
vec3 AIGetFurthestCoverPoint(vec3 opponent, vec3 target, float range)
This function returns the furthest point from a given point( also called the target point) in which t...
void ResetObjectFlags(string objname, string flags)
This function sets to FALSE all input flags of an object.
void PhysicsObjectSleep()
This functions sets the state of the body associated with this object to sleeping.
bool PhysicsGetCollideFlag()
This function returns true if the physics object associated with this object can collide, false otherwise.
string GetAudioDevice(int i)
This function returns a string containing the description of the AudioDevice at index i...
void AISetSteeringWeight(string steer, float weight)
This function sets the weight of a steering behavior. Steering behaviors are used for steering AI cha...
void AIEnableHearing(bool enable, float range)
This function makes AI subsystem enable Hearing feature for this object AI.
vec3 Vec3(float x, float y, float z)
This function returns a 3d vector given 3 float numbers as input. It is useful to build a vec3 from 3...
void SetSource(float gain, float range)
This function creates a sound source and assign it to this object.
void CreateHUDWidget(string class, string script, string params, string pos)
This function is equal to CreateWidget() function.
void PlayAnimation(int channel, bool loop)
This function plays all the animations of a channel.
void PlaySoundGlobal(string sound, bool loop)
This function plays a global sound given its filename.
string GetParam(string param)
This function returns the value of a specified param of this object if this is an object script or th...
bool IsKeyPressed(string key, int mode)
This function returns true if a keyboard key pressed. Otherwise it returns false. ...
vec3 AIGetNearestCoverPoint(vec3 opponent, vec3 target, float range)
This function returns the nearest point from a given point( also called the target point) in which th...
void PhysicsSetRagdollCollideFlag()
This function sets to true the collide flag of all the capsules of a ragdoll associated with this obj...
void SendMessageMulti(string name, string content, float range, string class)
This function send a message to more than one active object. The receiver objects are choosen basing ...
void PhysicsRagdollWakeUp()
This functions sets the state of a ragdoll associated with this object (i.e. the state the all the ra...
void ActiveObject(string objname, vec3 pos, vec3 angles)
This function activates a stock object. You have also to specify the position and orientation of the ...
vec3 GetObjectWorldAngles(string objname)
This function returns the orientation of an object in world space as euler angles. Angles are returned as a vec3 (yaw, pitch, roll).
float Sin(float angle)
This function returns the sine value of a given angle. The angle value is expressed in degrees...
int Int(string s)
This function convert a string value into an integer value.
void DestroySubWidget(string widget)
This function destroys a child widget of this widget, if it exists.
vec3 GetWorldAxis(string axis)
This function returns one of the 3 axis of THIS object (object owning the script) orthonormal basis i...
vec3 VectorRotate(vec3 v, float angle, vec3 axis)
This function rotates a 3d vector(also 3d point) given an angle of rotation and an axis of rotation...
vec3 GetMousePos()
This function returns a 3d vector containing the mouse position.
void StopAnimation(int channel)
This function stops an animation channel, i.e. it stops all the animations of the channel...
void PhysicsSetCollideFlag()
This function sets to true the collide flag of physics object associated with this object...
vec4 String2Vec4(string s)
This function convert a string into a 4d vector.
void EngineResume()
This function resumes the simulation (or game) previously paused.
bool LoadLevel(string level)
This function loads a game scene given its filename.
void PhysicsRagdollSleep()
This functions sets the state of a ragdoll associated with this object (i.e. the state the all the ra...
void EnginePause()
This function pauses the simulation or game.
bool PhysicsObjectIsSleeping()
This functions returns true if the state of physics object associated with this object is set to slee...
void FindPath(vec3 target)
This function computes an AI path from this object position to a given target point.
void SetAnimationChannelMask(int channel, string maskname)
This function assigns a mask to a given channel.
string PhysicsGetCollidedObject()
This function returns the name of the object collided in a previous sweep test.
void LOG(string str)
The function writes the input string into the S2Engine LOG file.
string String(float f)
This function convert an integer, a float, a boolean, a 3d vector or a 4d vector value into a string...
void BlendCurrentAnimation(string anim, float weight, int channel)
This function is the core of animation system, It assigns a channel to an animation and also sets ani...
float ScalarInterpolate(float s1, float s2, float t)
This function returns the result of the linear interpolation between two input float numbers...
vec3 GetMouseRelPos()
This function returns a 3d vector containing the mouse position relative to the previous frame...
float PhysicsGetVehicleRPM()
This function returns the rotation per minute (RPM) of the engine of physics vehicle associated to th...
vec3 CrossProduct(vec3 v1, vec3 v2)
This function returns the cross product between two given 3D vectors.
void SetSourceRange(float range)
This function sets the sound source range of influence.
void PauseAnimation(int channel)
This function pause an animation channel, i.e. it pauses all the animations of the channel...
void PhysicsCreateVehicle(string vehicleBody, string frontWheels, string backWheels, string props)
TThis function creates a vehicle into the physics subsystem and associates it to this object...
void SendMessageBroad(string dest, string name, string content)
This function send a message to all active objects.
void AISetCharacterMaxLinear(float acc, float speed)
This function sets the maximum linear accelleration and maximum linear velocity of this object if it ...
void PhysicsSetObjectPos(vec3 pos)
This function stes the position of this object if it is associated to a physics object.
vec3 VectorToAngles(vec3 v)
This function returns the orientation of a given 3d vector expressed as the float triple yaw...
void ShowCursor(bool show)
This function shows/hides the GUI cursor. It has effects only into the main GUI widget.
bool AIObjectIsViewed(string obj)
This function returns true if an object is viewed by this object.
bool PhysicsCharacterCollisionTest(string obj, vec3 start, vec3 end)
This function executes the Sweep test of an object using the capsule of a physics character associate...
void SetSubWidgetPos(string widget, float x, float y)
This function assigns a new position to the child widget of this widget.
vec3 PhysicsGetCollisionNormal()
This function returns the collision normal of the object collided in a previous sweep test...
bool GetInputAction(string name)
This function returns the value of an input action given its identifying name.
string SetObjectParam(string objname, string paramname, string paramvalue)
This function sets the value of the parameter of an object given as string.
float Abs(float scalar)
This function returns the Absolute value of a given float number.
void AnimationCrossFade(int channel, string animName, float time)
This function executes a cross fade between a given animation and all others.
void AddAnimationToChannel(int channel, string animName)
This function Adds an animation to a pre-added animation channel of an entity.
void RestartLevel()
This function restores the starting state of the game scene without close/reload it.
bool PhysicsCollisionTest(float radius, vec3 start, vec3 end)
This function executes the Collision(Sweep) Test test of a sphere. The sweep test is made by extrudin...
void CloseLevel()
This function closes an entire game scene.
void CreateHUD(string script)
This function creates the HUD main widget. Using CreateHUDWidget() function you can attach new widget...
void AISetTargetToReachPos(vec3 target)
This function sets the target point that AI character must to reach using Steering behaviors...
void StopSoundGlobal()
This function stops the global sound source.
void PhysicsApplyDirForceToRagdoll(vec3 dir, float len)
This function applies a directional force to all the nodes of the Ragdoll associated to this object...
void SetAnimationBlendY(int channel, string animName, float value)
This function assigns a blend float value to a blended animation in Y direction.
float DotProduct(vec3 v1, vec3 v2)
This function returns the Dot product between two given 3D vectors.
string GetVideoMode(int i)
This function returns a string containing the description of the supported Video Mode at index i...
int GetNumVideoModes()
This function returns the number of video modes supported by the hardware system. ...
vec3 PhysicsGetCharacterDims()
This function returns the dimensions of the capsule of a physics character associated to this object...
vec3 AIGetNearestTacticalCoverPoint(vec3 opponent, vec3 target, float range, int ID)
This function returns the nearest point from a given point( also called the target point) in which th...
string AIGetNearestViewedObject()
This function returns the name of the nearest object viewed by this object.
float GetInputAxis(string name)
This function returns the value of an input axis given its identifying name. Value returned is alread...
void PhysicsResetRagdollCollideFlag()
This function sets to false the collide flag of all the capsules of a ragdoll associated with this ob...
void StopMusic(int channel)
This function stops a music playing on a given channel.
void SpawnObject(string prefabFilename, vec3 pos, vec3 angles)
This function creates an object taking its description from a prefab resource.
vec3 PhysicsGetObjectPos()
This function returns the position of this object if it is associated to a physics object...
void PhysicsResetCollideFlag()
This function sets to false the collide flag of physics object associated with this object...
bool IsSoundPlaying()
This function returns true if the sounde source of this object is still playing a sound...
void ShowParentWidget(bool show)
This function shows/hides the parent of this widget.