S2ENGINE HD
1.4.6
Official manual about S2Engine HD editor and programming
|
Script language functions. More...
Go to the source code of this file.
Functions | |
Casting | |
Casting functions. | |
bool | Bool (float f) |
This function convert an integer, a float, or a string value into a boolean value. More... | |
bool | Bool (int i) |
This function convert an integer, a float, or a string value into a boolean value. More... | |
bool | Bool (string s) |
This function convert an integer, a float, or a string value into a boolean value. More... | |
float | Float (string s) |
This function convert an integer, or a string value into a float value. More... | |
float | Float (int i) |
This function convert an integer, or a string value into a float value. More... | |
int | Int (string s) |
This function convert a string value into an integer value. More... | |
int | Int (float f) |
This function convert a float value into an integer value. More... | |
string | String (float f) |
This function convert an integer, a float, a boolean, a 3d vector or a 4d vector value into a string. More... | |
string | String (bool b) |
This function convert an integer, a float, a boolean, a 3d vector or a 4d vector value into a string. More... | |
string | String (int i) |
This function convert an integer, a float, a boolean, a 3d vector or a 4d vector value into a string. More... | |
string | String (vec3 v3) |
This function convert an integer, a float, a boolean, a 3d vector or a 4d vector value into a string. More... | |
string | String (vec4 v4) |
This function convert an integer, a float, a boolean, a 3d vector or a 4d vector value into a string. More... | |
vec3 | String2Vec3 (string s) |
This function convert a string into a 3d vector. More... | |
vec4 | String2Vec4 (string s) |
This function convert a string into a 4d vector. More... | |
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 float. More... | |
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. More... | |
GUI | |
GUI functions. | |
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. More... | |
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. More... | |
void | CreateHUD (string script) |
This function creates the HUD main widget. Using CreateHUDWidget() function you can attach new widgets to it. More... | |
void | CreateHUDWidget (string class, string script, string params, string pos) |
This function is equal to CreateWidget() function. More... | |
void | DestroySubWidget (string widget) |
This function destroys a child widget of this widget, if it exists. More... | |
string | GetSubWidgetParam (string widget, string param) |
This function returns a param value of child widget of this widget, if it exists. More... | |
void | ResetSubWidgetFlag (string sw, string flags) |
This function resets( sets to false) the flags of a widget that is a child of this one. More... | |
void | SetSubWidgetFlag (string sw, string flags) |
This function sets (to true) the flags of a widget that is a child of this one. More... | |
void | SetSubWidgetOpacity (string widget, float opacity) |
This function sets the opacity level of the tree starting from the child widget of this widget. More... | |
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. More... | |
void | SetSubWidgetPos (string widget, float x, float y) |
This function assigns a new position to the child widget of this widget. More... | |
void | SetWidgetOpacity (float opacity) |
This function sets the opacity level of the tree starting from this widget. More... | |
void | ShowCursor (bool show) |
This function shows/hides the GUI cursor. It has effects only into the main GUI widget. More... | |
void | ShowParentWidget (bool show) |
This function shows/hides the parent of this widget. More... | |
void | ShowSubWidget (string widget, bool show) |
This function shows/hides a child of this widget given its name. More... | |
void | ShowWidget (bool show) |
This function shows/hides this widget. More... | |
Physics | |
Physics functions. | |
void | PhysicsCreateCharacter () |
This function creates a character into the physics subsystem and associates it to this object. The Characters of the physics subsystem are specifically designed for intergrating the game-like character control with a realistic physical simulation. More... | |
void | PhysicsCreateCharacter (float slopeLimit) |
This function creates a character into the physics subsystem and associates it to this object. The Characters of the physics subsystem are specifically designed for intergrating the game-like character control with a realistic physical simulation. More... | |
void | PhysicsCreateBody (string coltype, float mass, vec3 props) |
This function creates a physics rigid body and associates it to 'this object'. More... | |
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. More... | |
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 extruding the sphere from a start point to an end point and checking if there is some object inside the extrusion. It returns true if the sweep test has success, false otherwise. More... | |
void | PhysicsVehicleControl (float steerAngle, float acc, bool handbrake) |
This function moves this object if it is associated with a physics vehicle. More... | |
void | PhysicsApplyForce (vec3 point, vec3 dir, float len) |
This function applies a force to this object if it has a physics object associated. More... | |
void | PhysicsApplyForce (vec3 point, string axis, float len) |
This function applies a force to this object if it has a physics object associated. More... | |
void | PhysicsApplyDirForceToRagdoll (vec3 dir, float len) |
This function applies a directional force to all the nodes of the Ragdoll associated to this object. Directional means that there is no need for a point of application. More... | |
void | PhysicsApplyDirForceToRagdoll (string axis, float len) |
This function applies a directional force to all the nodes of the Ragdoll associated to this object. Directional means that there is no need for a point of application. More... | |
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 node has a physics object associated, i.e. in the case of a Ragdoll. More... | |
void | PhysicsApplyForceToNode (string node, vec3 point, string axis, float len) |
This function applies a force to a node of this object. This function has effect only if the object node has a physics object associated, i.e. in the case of a Ragdoll. More... | |
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 identified by its name. More... | |
void | PhysicsApplyForceToObject (string obj, vec3 point, string axis, float len) |
This function applies a force to an object if it has a physics object associated. The object is identified by its name. More... | |
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 identified by its name. More... | |
void | PhysicsApplyForceToRagdoll (vec3 point, string axis, float len) |
This function applies a force to all the nodes of the Ragdoll associated to this object. More... | |
void | PhysicsApplyGravity (bool apply) |
This function sets to true/false the gravity application on the physics object associated to this object except if it is a character. More... | |
bool | PhysicsCharacterCollisionTest (string obj, vec3 start, vec3 end) |
This function executes the Sweep test of an object using the capsule of a physics character associated to it. More... | |
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. More... | |
void | PhysicsCharacterToRagdoll () |
This function stops all animation channels, wakeUp the ragdoll associated with This Object, excludes from collision and set to sleeping the physics character associated with this object. In other words this function makes the Ragdoll simulation starting. More... | |
void | PhysicsCreateRagdoll () |
This function creates a Ragdoll basing on this object model format. More... | |
vec3 | PhysicsGetCharacterDims () |
This function returns the dimensions of the capsule of a physics character associated to this object. More... | |
string | PhysicsGetCollidedObject () |
This function returns the name of the object collided in a previous sweep test. More... | |
bool | PhysicsGetCollideFlag () |
This function returns true if the physics object associated with this object can collide, false otherwise. More... | |
vec3 | PhysicsGetCollisionNormal () |
This function returns the collision normal of the object collided in a previous sweep test. More... | |
vec3 | PhysicsGetObjectPos () |
This function returns the position of this object if it is associated to a physics object. More... | |
float | PhysicsGetVehicleRPM () |
This function returns the rotation per minute (RPM) of the engine of physics vehicle associated to this object. More... | |
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 parent node world positions. More... | |
bool | PhysicsObjectIsSleeping () |
This functions returns true if the state of physics object associated with this object is set to sleeping, otherwise returns false. More... | |
void | PhysicsObjectSleep () |
This functions sets the state of the body associated with this object to sleeping. More... | |
void | PhysicsObjectWakeUp () |
This functions sets the state of the body associated with this object to wake up. More... | |
void | PhysicsRagdollSleep () |
This functions sets the state of a ragdoll associated with this object (i.e. the state the all the ragdoll capsules) to sleeping. More... | |
void | PhysicsRagdollWakeUp () |
This functions sets the state of a ragdoll associated with this object (i.e. the state the all the ragdoll capsules) to wake up. More... | |
void | PhysicsResetCollideFlag () |
This function sets to false the collide flag of physics object associated with this object. More... | |
void | PhysicsResetRagdollCollideFlag () |
This function sets to false the collide flag of all the capsules of a ragdoll associated with this object. More... | |
void | PhysicsSetCharacterDims (vec3 dims) |
This function sets the dimensions of the capsule of a physics character associated to this object. More... | |
void | PhysicsSetCharacterGravity (float gravity) |
This function sets the amount of the gravity applied on the physics character associated with this object. More... | |
void | PhysicsSetCollideFlag () |
This function sets to true the collide flag of physics object associated with this object. More... | |
void | PhysicsSetObjectPos (vec3 pos) |
This function stes the position of this object if it is associated to a physics object. More... | |
void | PhysicsSetRagdollCollideFlag () |
This function sets to true the collide flag of all the capsules of a ragdoll associated with this object. More... | |
Math | |
Math functions. | |
float | Abs (float scalar) |
This function returns the Absolute value of a given float number. More... | |
float | Min (float a, float b) |
This function returns the minimum value between two given float values. More... | |
float | Max (float a, float b) |
This function returns the maximum value between two given float values. More... | |
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. More... | |
vec3 | CrossProduct (vec3 v1, vec3 v2) |
This function returns the cross product between two given 3D vectors. More... | |
float | DotProduct (vec3 v1, vec3 v2) |
This function returns the Dot product between two given 3D vectors. More... | |
vec3 | NormalizeV (vec3 v) |
This function returns a normalized 3d vector. More... | |
float | Cos (float angle) |
This function returns the cosine value of a given angle. The angle value is expressed in degrees. More... | |
float | Rand (int res) |
This function returns a float random number between 0.0 and 1.0 given the number of all possible choices. More... | |
float | ScalarInterpolate (float s1, float s2, float t) |
This function returns the result of the linear interpolation between two input float numbers, given the parameter t. More... | |
vec3 | ScreenToWorld (vec3 p) |
This function transforms a point from screen coordinates space to world coordinates space. This function is useful, for example, when you need to check if the user have clicked on a 3d object with the mouse cursor. More... | |
float | Sin (float angle) |
This function returns the sine value of a given angle. The angle value is expressed in degrees. More... | |
vec3 | VectorInterpolate (vec3 s1, vec3 s2, float t) |
This function returns the result of the linear interpolation between two input 3d Vectors, given the parameter t. More... | |
float | VectorLen (vec3 v) |
This function returns the Length of a 3d vector. More... | |
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. It is equal to multiply a 3d point with a rotation matrix. More... | |
vec3 | VectorToAngles (vec3 v) |
This function returns the orientation of a given 3d vector expressed as the float triple yaw,pitch,roll where: More... | |
vec3 | WorldToScreen (vec3 p) |
This function transforms a point from world coordinates space to screen coordinates space. It is the inverse operation of ScreenToWorld function. This function is useful if you want to put a widget (for example a text label) near the projection on screen of a 3d object. More... | |
Audio | |
Audio functions. | |
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 other channels . More... | |
void | PlayMusic (string music, int channel) |
This function play a music on a given channel. More... | |
void | PlaySound (string sound, bool loop) |
This function plays a sound given its filename. More... | |
void | PlaySoundGlobal (string sound, bool loop) |
This function plays a global sound given its filename. More... | |
void | SetSource (float gain, float range) |
This function creates a sound source and assign it to this object. More... | |
void | SetSourcePitch (float pitch) |
This function sets the sound source pitch. More... | |
void | SetSourceRange (float range) |
This function sets the sound source range of influence. More... | |
void | SetSourceVolume (float volume) |
This function sets the sound source volume. More... | |
void | StopMusic (int channel) |
This function stops a music playing on a given channel. More... | |
void | StopSound () |
This function stops a sound playing on this object source. More... | |
void | StopSoundGlobal () |
This function stops the global sound source. More... | |
bool | IsSoundPlaying () |
This function returns true if the sounde source of this object is still playing a sound. Otherwise returns false. More... | |
AI | |
AI functions. | |
void | AICreateCharacter (float radius, float height, string maxLinear, string maxAngular) |
This function creates a character for the AI subsystem. More... | |
void | AICreateObject (bool isObstacle, bool isOccluder, float radius, float height) |
This function creates an object for the AI subsystem. More... | |
void | AIEnableHearing (bool enable, float range) |
This function makes AI subsystem enable Hearing feature for this object AI. More... | |
void | AIEnableVision (bool enable, string eyeNode, float range) |
This function makes AI subsystem enable Vision feature for this object AI. More... | |
void | FindPath (vec3 target) |
This function computes an AI path from this object position to a given target point. More... | |
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 the character is covered from another given point, the opponent point. More... | |
vec3 | AIGetNearestAllowedPoint (vec3 target, float range) |
This function returns the nearest point (nearest to a given 'target point') toward which the character can move. More... | |
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 the character is covered from another given point, the opponent point. More... | |
string | AIGetNearestHeardObject () |
This function returns the name of the nearest object heard by this object. More... | |
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 the character is covered from another given point, the opponent point. More... | |
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 the character have to patrol. More... | |
string | AIGetNearestViewedObject () |
This function returns the name of the nearest object viewed by this object. More... | |
bool | AIObjectIsHeard (string obj) |
This function returns true if an object is heard by this object. More... | |
bool | AIObjectIsViewed (string obj) |
This function returns true if an object is viewed by this object. More... | |
bool | AIPointIsInsideWaypointArea (vec3 point) |
This function returns true if a give point is inside a WaypointArea. More... | |
void | AISetCharacterMaxAngular (float acc, float speed) |
This function sets the maximum angular accelleration and maximum angular velocity of this object if it is associated with an AI character. More... | |
void | AISetCharacterMaxLinear (float acc, float speed) |
This function sets the maximum linear accelleration and maximum linear velocity of this object if it is associated with an AI character. More... | |
void | AISetSteeringWeight (string steer, float weight) |
This function sets the weight of a steering behavior. Steering behaviors are used for steering AI characters, in the sense of walk, seek, avoid obstacles, follow paths, etc... More... | |
void | AISetTargetToFacePos (vec3 target) |
This function sets the target point that AI character must to face using Steering behaviors. More... | |
void | AISetTargetToReachPos (vec3 target) |
This function sets the target point that AI character must to reach using Steering behaviors. More... | |
Input | |
Input functions. | |
bool | GetInputAction (string name) |
This function returns the value of an input action given its identifying name. More... | |
float | GetInputAxis (string name) |
This function returns the value of an input axis given its identifying name. Value returned is already scaled basing on the input map configuration. More... | |
bool | IsKeyPressed (string key, int mode) |
This function returns true if a keyboard key pressed. Otherwise it returns false. More... | |
vec3 | GetMousePos () |
This function returns a 3d vector containing the mouse position. More... | |
vec3 | GetMouseRelPos () |
This function returns a 3d vector containing the mouse position relative to the previous frame. In other words it returns the displace of the mouse from the previous frame, if mouse doesn't move, it returns a zero vector. More... | |
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: More... | |
System | |
System functions. | |
void | LOG (string str) |
The function writes the input string into the S2Engine LOG file. More... | |
int | GetNumVideoModes () |
This function returns the number of video modes supported by the hardware system. More... | |
string | GetVideoMode (int i) |
This function returns a string containing the description of the supported Video Mode at index i. More... | |
void | CloseLevel () |
This function closes an entire game scene. More... | |
bool | LoadLevel (string level) |
This function loads a game scene given its filename. More... | |
void | Exit () |
This function shutdown the engine and exit from the application. More... | |
void | EnginePause () |
This function pauses the simulation or game. More... | |
void | EngineResume () |
This function resumes the simulation (or game) previously paused. More... | |
string | GetAudioDevice (int i) |
This function returns a string containing the description of the AudioDevice at index i. More... | |
string | GetEngineParam (string param) |
This function returns the value of a specified param of the engine and its subsystems: render, audio, physics. More... | |
string | GetLevelParam (string param) |
This function returns the value of a specified param of the current scene. More... | |
int | GetNumAudioDevice () |
This function returns the number of audio devices supported by the hardware system. More... | |
string | Load (string path) |
This function loads a text file and returns its content as a string. More... | |
void | LoadResource (string resPath, string cache) |
This function loads a resource given its filename. More... | |
void | RestartLevel () |
This function restores the starting state of the game scene without close/reload it. More... | |
void | Save (string text, string path) |
This function saves a string into a text file. More... | |
void | SetEngineParam (string param, string value) |
This function sets the value of a specified param of the engine and its subsystems: Render, Physics, Audio. More... | |
void | SetLevelParam (string param, string value) |
This function sets the value of a specified param of the current scene. More... | |
void | SetTimeScale (float timeMul) |
This function sets the simulation time speed multiplier. More... | |
Animation | |
Animation functions. | |
int | AddAnimationChannel () |
This function Adds an animation channel to the animation channel list of an entity. More... | |
void | AddAnimationToChannel (int channel, string animName) |
This function Adds an animation to a pre-added animation channel of an entity. More... | |
void | SetAnimationBlendX (int channel, string animName, float value) |
This function assigns a blend float value to a blended animation in X direction. More... | |
void | SetAnimationBlendY (int channel, string animName, float value) |
This function assigns a blend float value to a blended animation in Y direction. More... | |
void | AnimationCrossFade (int channel, string animName, float time) |
This function executes a cross fade between a given animation and all others. More... | |
void | AnimationChannelFadeIn (int channel, float time) |
This function starts the 'fade in' transition of an animation channel. More... | |
void | AnimationChannelFadeOut (int channel, float time) |
This function starts the 'fade Out' transition of an animation channel. More... | |
void | BlendAnimationChannel (int channel, float weight) |
This function sets the blend weight value of an animation channel given its ID number. More... | |
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 animation weight. More... | |
void | PauseAnimation (int channel) |
This function pause an animation channel, i.e. it pauses all the animations of the channel. More... | |
void | PlayAnimation (int channel, bool loop) |
This function plays all the animations of a channel. More... | |
void | SetAnimationChannelMask (int channel, string maskname) |
This function assigns a mask to a given channel. More... | |
void | SetAnimationChannelSpeed (int channel, float speed) |
This function sets the overall speed of an animation channel. More... | |
void | StopAnimation (int channel) |
This function stops an animation channel, i.e. it stops all the animations of the channel. More... | |
bool | IsAnimationStopped (int channel) |
This function returns true if the specified animation channel isn't playing. Otherwise it returns false. More... | |
Objects | |
Objects/Scene functions. | |
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 widget if this is a widget script. More... | |
string | GetParam (string param) |
This function returns the value of a specified param of this object if this is an object script or this widget if this is a widget script. More... | |
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 object to activate. More... | |
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 will move together this object, i.e. Its parent). This action is usually performed at init time, but it is not necessary. More... | |
void | SpawnObject (string prefabFilename, vec3 pos, vec3 angles) |
This function creates an object taking its description from a prefab resource. More... | |
void | SetObjectFlags (string objname, string flags) |
This function sets to TRUE all input flags of an object. More... | |
void | ResetObjectFlags (string objname, string flags) |
This function sets to FALSE all input flags of an object. More... | |
bool | GetObjectFlag (string objname, string flag) |
This function returns the value (TRUE or FALSE) of an object flag. More... | |
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 parameters depending on its class. More... | |
string | SetObjectParam (string objname, string paramname, string paramvalue) |
This function sets the value of the parameter of an object given as string. More... | |
string | GetObjectScriptParam (string objname, string paramname, bool isStock) |
This function returns the value of the parameter of the object script as string. More... | |
vec3 | GetObjectWorldPos (string objname) |
This function returns the worldspace position of an object. More... | |
vec3 | GetObjectWorldAxis (string objname, string axis) |
This function returns one of the 3 axis of object orthonormal basis in worldspace. More... | |
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). More... | |
vec3 | GetWorldAxis (string axis) |
This function returns one of the 3 axis of THIS object (object owning the script) orthonormal basis in worldspace. More... | |
vec3 | GetAxis (string axis) |
This function returns one of the 3 axis of THIS object (object owning the script) orthonormal basis in localspace. More... | |
Messages | |
Messages functions. | |
void | SendMessageSingle (string dest, string name, string content) |
This function send a message to a single active object given its name. More... | |
void | SendMessageSingle (string dest, string name, string content, float delay) |
This function send a message to a single active object given its name. More... | |
void | SendMessageBroad (string dest, string name, string content) |
This function send a message to all active objects. More... | |
void | SendMessageBroad (string dest, string name, string content, float delay) |
This function send a message to all active objects. More... | |
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 on a range of influence and a specified class. More... | |
void | SendMessageMulti (string name, string content, float range, float delay) |
This function send a message to more than one active object. The receiver objects are choosen basing on a range of influence and a specified class. More... | |
void | SendMessageGUI (string name, string content) |
This function sends a message to the main widget of the GUI. More... | |
void | SendMessageGUI (string name, string content, float delay) |
This function sends a message to the main Widget of the GUI. More... | |
void | SendMessageHUD (string name, string content) |
This function sends a message to the main widget of the HUD. More... | |
void | SendMessageHUD (string name, string content, float delay) |
This function sends a message to the main Widget of the HUD. More... | |
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. More... | |
Script language functions.
A comprehensive reference of all built-in S2Engine HD scripting language functions.
float Abs | ( | float | scalar | ) |
void ActiveObject | ( | string | objname, |
vec3 | pos, | ||
vec3 | angles | ||
) |
int AddAnimationChannel | ( | ) |
This function Adds an animation channel to the animation channel list of an entity.
void AddAnimationToChannel | ( | int | channel, |
string | animName | ||
) |
This function Adds an animation to a pre-added animation channel of an entity.
channel | ID of the channel to which add the animation |
animName | name of the animation to add |
void AICreateCharacter | ( | float | radius, |
float | height, | ||
string | maxLinear, | ||
string | maxAngular | ||
) |
This function creates a character for the AI subsystem.
Usually it is called during a object initialization when we want AI subsystem manage this object AI as character (or NPC).
radius | radius of the AI character. Used by AI system for obstacle avoidance behavior, for separation behavior and other things. |
height | height of the AI character. Not used for now. |
maxLinear | string composed by 2 values separated by a ',' symbol: first value is max linear accelleration of the character, second is max linear speed of the character. |
maxAngular | string composed by 2 values separated by a ',' symbol: first value is max angular accelleration of the character, second is max angular speed of the character. |
void AICreateObject | ( | bool | isObstacle, |
bool | isOccluder, | ||
float | radius, | ||
float | height | ||
) |
This function creates an object for the AI subsystem.
Usually it is called during a object initialization when we want AI subsystem manage 'this object as obstacle and/or occluder for the characters AI.
isObstacle | true if the AI object must be an obstacle, false otherwise. |
isOccluder | true if the AI object must be an occluder, false otherwise. |
radius | radius of the AI obstacle. |
height | height of the AI obstacle. |
void AIEnableHearing | ( | bool | enable, |
float | range | ||
) |
void AIEnableVision | ( | bool | enable, |
string | eyeNode, | ||
float | range | ||
) |
This function makes AI subsystem enable Vision feature for this object AI.
Of course it has effects if this object is an AI character.
enable | true if hearing must be enable, false otherwise. |
eyeNode | the node from which the character see the scene (i.e. its eye). |
range | max distance at which the character can view. |
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 the character is covered from another given point, the opponent point.
The cover points are choosen inside a given range from this object position, and also they are choosen among points behind obstacles and AI points of type COVER_POINT inserted into the scene by level designers.
opponent | the point from which the character want to cover. |
target | the point from which to compute maximum distance. |
range | the range inside which to choose cover points. |
vec3 AIGetNearestAllowedPoint | ( | vec3 | target, |
float | range | ||
) |
This function returns the nearest point (nearest to a given 'target point') toward which the character can move.
This function is used when you want NPC choose a valid point (not inside an obstacle, not inside a forbidden area, etc..) toward which to move.
target | the point from which to compute minimum distance. |
range | the range inside which to choose allowed points. |
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 the character is covered from another given point, the opponent point.
The cover points are choosen inside a given range from this object position, and also they are choosen among points behind obstacles and AI points of type COVER_POINT inserted into the scene by level designers.
opponent | the point from which the character want to cover. |
target | the point from which to compute minimum distance. |
range | the range inside which to choose cover points. |
string AIGetNearestHeardObject | ( | ) |
This function returns the name of the nearest object heard by this object.
opponent | the point from which the character want to cover. |
target | the point from which to compute minimum distance. |
range | the range inside which to choose cover points. |
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 the character is covered from another given point, the opponent point.
Cover points are choosen inside a given range from this object position. This function differs from AIGetNearestCoverPoint function by the fact that cover point are also choosen only among AI points of type COVER_POINT of a specified ID.
opponent | the point from which the character want to cover. |
target | the point from which to compute minimum distance. |
range | the range inside which to choose cover points. |
ID | only cover point that have ID equal to it are choosen. |
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 the character have to patrol.
Patrol points are choosen inside a given range from this object position. This function differs from AIGetNearestTacticalCoverPoint function by the fact that cover point are also choosen only among AI points of type PATROL_POINT of a specified ID.
target | the point from which to compute minimum distance. |
range | the range inside which to choose patrol points. |
ID | only patrol points that have ID equal to it are choosen. |
string AIGetNearestViewedObject | ( | ) |
This function returns the name of the nearest object viewed by this object.
bool AIObjectIsHeard | ( | string | obj | ) |
This function returns true if an object is heard by this object.
obj | name of the object to check if it's heard. |
bool AIObjectIsViewed | ( | string | obj | ) |
This function returns true if an object is viewed by this object.
obj | name of the object to check if it's heard. |
bool AIPointIsInsideWaypointArea | ( | vec3 | point | ) |
This function returns true if a give point is inside a WaypointArea.
point | point to check if inside waypoint area. |
void AISetCharacterMaxAngular | ( | float | acc, |
float | speed | ||
) |
This function sets the maximum angular accelleration and maximum angular velocity of this object if it is associated with an AI character.
These parameters are used when character steering behaviors are performed.
acc | angular accelleration to set. |
speed | angular speed to set. |
void AISetCharacterMaxLinear | ( | float | acc, |
float | speed | ||
) |
This function sets the maximum linear accelleration and maximum linear velocity of this object if it is associated with an AI character.
These parameters are used when character steering behaviors are performed.
acc | linear accelleration to set. |
speed | linear speed to set. |
void AISetSteeringWeight | ( | string | steer, |
float | weight | ||
) |
This function sets the weight of a steering behavior. Steering behaviors are used for steering AI characters, in the sense of walk, seek, avoid obstacles, follow paths, etc...
There is a variety of behaviors in S2ENGINE HD AI system, they are can be combined together usign a weighted blending. This means that bigger is the weight of the given behavior, bigger is its influence among the other ones upon the overall behavior of the AI character.
steer | name of the behavior. see Steering behaviors for the complete list of steering behaviors. |
weight | weight to set. |
void AISetTargetToFacePos | ( | vec3 | target | ) |
This function sets the target point that AI character must to face using Steering behaviors.
In S2Engine HD, NPC movements are separated into Reaching and Facing type:
Reaching
means the character moves to reach a certain position.Facing
means that character turns to reach a certain orientation.target | target point to face. |
void AISetTargetToReachPos | ( | vec3 | target | ) |
This function sets the target point that AI character must to reach using Steering behaviors.
In S2Engine HD, NPC movements are separated into Reaching and Facing type:
Reaching
means the character moves to reach a certain position.Facing
means that character turns to reach a certain orientation.target | target point to reach. |
void AnimationChannelFadeIn | ( | int | channel, |
float | time | ||
) |
This function starts the 'fade in' transition of an animation channel.
In other words it make the weight of the channel pass from its current value to 1.0 value. It is used in conjunction with AnimationChannelFadeOut and it is useful when you want to pass to an animation channel with a transition. You can specify the duration, in milliseconds, of the transition.
channel | ID number of the channel |
time | the duration (in milliseconds) of the transition |
void AnimationChannelFadeOut | ( | int | channel, |
float | time | ||
) |
This function starts the 'fade Out' transition of an animation channel.
In other words it make the weight of the channel pass from its current value to 0.0 value (that means tha animation channel disappear). It is used in conjunction with AnimationChannelFadeIn and it is useful when you want to exit from an animation channel with a transition. You can specify the duration, in milliseconds, of the transition.
channel | ID number of the channel |
time | the duration (in milliseconds) of the transition |
void AnimationCrossFade | ( | int | channel, |
string | animName, | ||
float | time | ||
) |
This function executes a cross fade between a given animation and all others.
The function works in the following way: animation weight is gradually brought to 1.0 value while all other animations weights are gradually brought to 0.0 value.
channel | ID of the channel to which add the animation |
animName | name of the blended animation to set value |
time | duration of the transition, in milliseconds |
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 will move together this object, i.e. Its parent). This action is usually performed at init time, but it is not necessary.
objname | name of the stock object to activate. |
node | name of the node of this object on which to attach the object. |
pos | local position the attached object must have. |
angles | local orientation (yaw,pitch,roll triple) the attached object must have. |
void BlendAnimationChannel | ( | int | channel, |
float | weight | ||
) |
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 animation weight.
Weight can be a value between 0.0 and 1.0. A weight of value 0.0 means that animation has no effects (it is not played), a weight of value 1.0 means that animation is played just like it is. Intermediate values make animation to blend with other animations of the same channel. The max number of channels is limited only by the number of the animations and the fact that an animation can be associated to only one channel at a time.
anim | name of the animation. |
weight | blend weight to assign to animation. |
channel | channel ID to assign to animation. |
bool Bool | ( | float | f | ) |
This function convert an integer, a float, or a string value into a boolean value.
f | Input float. |
bool Bool | ( | int | i | ) |
This function convert an integer, a float, or a string value into a boolean value.
i | Input integer. |
bool Bool | ( | string | s | ) |
This function convert an integer, a float, or a string value into a boolean value.
s | Input string. |
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.
scalar | the input float number |
min | the clamp minimum value |
max | the clamp maximum value |
float Cos | ( | float | angle | ) |
This function returns the cosine value of a given angle. The angle value is expressed in degrees.
angle | value of the input angle expressed in degrees. |
void CreateHUD | ( | string | script | ) |
This function creates the HUD main widget. Using CreateHUDWidget() function you can attach new widgets to it.
script | filename of the HUD script |
void CreateHUDWidget | ( | string | class, |
string | script, | ||
string | params, | ||
string | pos | ||
) |
This function is equal to CreateWidget() function.
The only difference is that the created widget is attached to the main HUD frame, that becomes its parent.
class | type of widget to create (see widgets) |
script | filename of the script the widget must load when it is initialized. Remember scripts are resources. |
params | list of widgets params, specified inside a string (separated by ',' simbol):
|
pos | local position of the widget (two coordinates). The position is summed to widget alignment. |
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.
class | type of widget to create (see widgets) |
script | filename of the script the widget must load when it is initialized. Remember scripts are resources. |
params | list of widgets params, specified inside a string (separated by ',' simbol):
|
pos | local position of the widget (two coordinates). The position is summed to widget alignment. |
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 other channels .
music | the music filename. |
channel | the channel index. Must be form 0 to 3. |
vec3 CrossProduct | ( | vec3 | v1, |
vec3 | v2 | ||
) |
This function returns the cross product between two given 3D vectors.
v1 | the first vector |
v2 | the second vector |
void DestroySubWidget | ( | string | widget | ) |
This function destroys a child widget of this widget, if it exists.
widget | name of the child widget to destroy. |
float DotProduct | ( | vec3 | v1, |
vec3 | v2 | ||
) |
This function returns the Dot product between two given 3D vectors.
v1 | the first vector |
v2 | the second vector |
void EnginePause | ( | ) |
void FindPath | ( | vec3 | target | ) |
float Float | ( | string | s | ) |
float Float | ( | int | i | ) |
This function convert an integer, or a string value into a float value.
i | input integer |
string GetAudioDevice | ( | int | i | ) |
vec3 GetAxis | ( | string | axis | ) |
string GetEngineParam | ( | string | param | ) |
This function returns the value of a specified param of the engine and its subsystems: render, audio, physics.
param | name of the param to get. |
bool GetInputAction | ( | string | name | ) |
This function returns the value of an input action given its identifying name.
name | a string identifying the input action |
float GetInputAxis | ( | string | name | ) |
This function returns the value of an input axis given its identifying name. Value returned is already scaled basing on the input map configuration.
name | a string identifying the input axis |
string GetLevelParam | ( | string | param | ) |
This function returns the value of a specified param of the current scene.
The returned value is always in string form, so it must be cast to the required type.
param | name of the param to get. |
vec3 GetMousePos | ( | ) |
vec3 GetMouseRelPos | ( | ) |
This function returns a 3d vector containing the mouse position relative to the previous frame. In other words it returns the displace of the mouse from the previous frame, if mouse doesn't move, it returns a zero vector.
int GetNumAudioDevice | ( | ) |
int GetNumVideoModes | ( | ) |
bool GetObjectFlag | ( | string | objname, |
string | flag | ||
) |
This function returns the value (TRUE or FALSE) of an object flag.
objname | name of the object |
flag | input flag. Valid flags are: cast_shadows,visible,collide,clip,moved,died,freezed,sleep. |
bool 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 parameters depending on its class.
objname | name of the object |
paramname | name of the parameter to retrieve. |
isStock | TRUE if object is a stock object, otherwise the object is active |
bool GetObjectScriptParam | ( | string | objname, |
string | paramname, | ||
bool | isStock | ||
) |
This function returns the value of the parameter of the object script as string.
objname | name of the object |
paramname | name of the parameter to retrieve. |
isStock | TRUE if object is a stock object, otherwise the object is active |
vec3 GetObjectWorldAngles | ( | string | objname | ) |
vec3 GetObjectWorldAxis | ( | string | objname, |
string | axis | ||
) |
vec3 GetObjectWorldPos | ( | string | objname | ) |
string GetParam | ( | string | param | ) |
This function returns the value of a specified param of this object if this is an object script or this widget if this is a widget script.
param | name of the param to get. |
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:
- \p 0 the keyboard key is detected as pressed until the user do not leave it. - \p 1 the keyboard key is detected as pressed only the first time the user click the button and not if the button remains pressed. - \p 2 the keyboard key is detected as pressed one time user leaves the button.
mode | pression detection mode. |
bool GetSubWidgetFlag | ( | string | sw, |
string | flag | ||
) |
string GetSubWidgetParam | ( | string | widget, |
string | param | ||
) |
This function returns a param value of child widget of this widget, if it exists.
The param is identified by its name. The value returned is always a string, you have to cast it to type you need.
widget | name of the child widget to destroy. |
param | name od the param to get |
string GetVideoMode | ( | int | i | ) |
This function returns a string containing the description of the supported Video Mode at index i.
Video modes are represented in the following format: widthXheightXherz, where
Example: 1024X768X60.
i | the index of the video mode. |
vec3 GetWorldAxis | ( | string | axis | ) |
int Int | ( | string | s | ) |
int Int | ( | float | f | ) |
This function convert a float value into an integer value.
f | input float |
bool IsAnimationStopped | ( | int | channel | ) |
This function returns true if the specified animation channel isn't playing. Otherwise it returns false.
channel | the ID of the channel you want check if is stopped |
bool IsKeyPressed | ( | string | key, |
int | mode | ||
) |
This function returns true if a keyboard key pressed. Otherwise it returns false.
key | the identifing name of the key to detect. |
mode | detection mode. |
There are 3 ways in which the keyboard key pression can be detected:
The keys of the keyboard are identified by strings containing the respective character. For expample the key 'a' is identified by the string "a", the key 'b' is identified by string "b", the key '1' is identified by string "1", etc... However there are some special keyborad keys that are identified with special strings preceded by symbol @:
Key | String |
BACKSPACE | "@backspace" |
RETURN | "@return" |
LCONTROL | "@lcontrol" |
RCONTROL | "@rcontrol" |
LSHIFT | "@lshift" |
RSHIFT | "@rshift" |
CAPSLOCK | "@capslock" |
NUMLOCK | "@numlock" |
TAB | "@tab" |
ESC | "@esc" |
F1 | "@f1" |
F2 | "@f2" |
F3 | "@f3" |
F4 | "@f4" |
F5 | "@f5" |
F6 | "@f6" |
F7 | "@f7" |
F8 | "@f8" |
F9 | "@f9" |
F10 | "@f10" |
F11 | "@f11" |
F12 | "@f12" |
NUMPAD0 | "@numpad0" |
NUMPAD1 | "@numpad1" |
NUMPAD2 | "@numpad2" |
NUMPAD3 | "@numpad3" |
NUMPAD4 | "@numpad4" |
NUMPAD5 | "@numpad5" |
NUMPAD6 | "@numpad6" |
NUMPAD7 | "@numpad7" |
NUMPAD8 | "@numpad8" |
NUMPAD9 | "@numpad9" |
UP | "@up" |
DOWN | "@down" |
RIGHT | "@right" |
LEFT | "@left" |
INS | "@ins" |
PGDOWN | "@pgdown" |
PGUP | "@pgup" |
DEL | "@del" |
HOME | "@home" |
NUMPADADD | "@add" |
NUMPADSUB | "@sub" |
NUMPADDIV | "@div" |
NUMPADDEC | "@dec" |
NUMPADENTER | "@enter" |
RALT | "@ralt" |
LALT | "@lalt" |
SCROLL | "@scroll" |
END | "@end" |
bool IsSoundPlaying | ( | ) |
This function returns true if the sounde source of this object is still playing a sound. Otherwise returns false.
string Load | ( | string | path | ) |
This function loads a text file and returns its content as a string.
Usually this function is used in conjunction with string manipulation functions, such as GetToken(), for parsing the returned string.
path | the path of the file to load |
bool LoadLevel | ( | string | level | ) |
This function loads a game scene given its filename.
level | filename of the game scene to load |
void LoadResource | ( | string | resPath, |
string | cache | ||
) |
This function loads a resource given its filename.
The filename must include also the relative path. Resource are loaded, stored and released by the Resource Manager. Resource manager stores resources into 3 different types of cache memory:
Level:
all resources stored in this cache are released when a level is closedStatic:
all resources stored in this cache are released when engine shutdownTemporary:
all resources stored in this cache are released when ClearTemporaryCache() function is called.In S2Engine HD resources are:
Every resource type has its directory: textures are in 'Textures' directory, materials in 'Materials', etc... Basing on the file extension S2Engine HD automatically recognizes the type of resource to load and puts the file pointer into the right resource type directory. So when you insert the resource filename to load you haven't to specify the main resource directory, only subdirectories if exist. When a resource is loaded it is stored inside a cache by Resource Manager. So, when the system require a resource, for example a sound to play with PlaySound function, the resource manager haven't to load the resource again. So the LoadResource function is useful to avoid loading a resource just when strictly required but also at initialization time, to speed things up.
resPath | filename (and relative path) of the resource to load |
cache | string identifying the cache in which store the resource. It can be: 'level', 'static', 'temp' |
void LOG | ( | string | str | ) |
float Max | ( | float | a, |
float | b | ||
) |
float Min | ( | float | a, |
float | b | ||
) |
vec3 NormalizeV | ( | vec3 | v | ) |
This function returns a normalized 3d vector.
v | Input vector |
void PauseAnimation | ( | int | channel | ) |
This function pause an animation channel, i.e. it pauses all the animations of the channel.
It differs from StopAnmiation function because It doesn't rewind the animations and it leaves weights unchanged.
channel | animation channel ID to pause. |
void PhysicsApplyDirForceToRagdoll | ( | vec3 | dir, |
float | len | ||
) |
This function applies a directional force to all the nodes of the Ragdoll associated to this object. Directional means that there is no need for a point of application.
dir | force direction normalize vector. |
len | intensity of the force |
axis | name of the axis to use as force direction:
|
void PhysicsApplyDirForceToRagdoll | ( | string | axis, |
float | len | ||
) |
This function applies a directional force to all the nodes of the Ragdoll associated to this object. Directional means that there is no need for a point of application.
len | intensity of the force |
axis | name of the axis to use as force direction:
|
void PhysicsApplyForce | ( | vec3 | point, |
vec3 | dir, | ||
float | len | ||
) |
This function applies a force to this object if it has a physics object associated.
point | point of application of the force. |
dir | force direction normalize vector. |
len | intensity of the force |
void PhysicsApplyForce | ( | vec3 | point, |
string | axis, | ||
float | len | ||
) |
This function applies a force to this object if it has a physics object associated.
point | point of application of the force. |
len | intensity of the force |
axis | name of the axis to use as force direction:
|
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 node has a physics object associated, i.e. in the case of a Ragdoll.
node | name of the node on which to apply force. |
point | point of application of the force. |
dir | force direction normalize vector. |
len | intensity of the force |
void PhysicsApplyForceToNode | ( | string | node, |
vec3 | point, | ||
string | axis, | ||
float | len | ||
) |
This function applies a force to a node of this object. This function has effect only if the object node has a physics object associated, i.e. in the case of a Ragdoll.
node | name of the node on which to apply force. |
point | point of application of the force. |
len | intensity of the force |
axis | name of the axis to use as force direction:
|
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 identified by its name.
obj | name of the object to which apply force. |
point | point of application of the force. |
dir | force direction normalize vector. |
len | intensity of the force |
void PhysicsApplyForceToObject | ( | string | obj, |
vec3 | point, | ||
string | axis, | ||
float | len | ||
) |
This function applies a force to an object if it has a physics object associated. The object is identified by its name.
obj | name of the object to which apply force. |
point | point of application of the force. |
len | intensity of the force |
axis | name of the axis to use as force direction:
|
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 identified by its name.
point | point of application of the force. |
dir | force direction normalize vector. |
len | intensity of the force |
void PhysicsApplyForceToRagdoll | ( | vec3 | point, |
string | axis, | ||
float | len | ||
) |
This function applies a force to all the nodes of the Ragdoll associated to this object.
point | point of application of the force. |
len | intensity of the force |
axis | name of the axis to use as force direction:
|
void PhysicsApplyGravity | ( | bool | apply | ) |
bool PhysicsCharacterCollisionTest | ( | string | obj, |
vec3 | start, | ||
vec3 | end | ||
) |
This function executes the Sweep test of an object using the capsule of a physics character associated to it.
The sweep test is made by extruding the character capsule from a start point to an end point and checking if there is some object inside the extrusion. It returns true if the sweep test has success, false otherwise.
name | of the object that has a physics character associated. |
start | start point. |
end | end point. |
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.
Update()
script callback function.dir | normalized direction of the movement |
disp | amount of movement displacement |
void PhysicsCharacterToRagdoll | ( | ) |
This function stops all animation channels, wakeUp the ragdoll associated with This Object, excludes from collision and set to sleeping the physics character associated with this object. In other words this function makes the Ragdoll simulation starting.
void PhysicsCollisionTest | ( | float | radius, |
vec3 | start, | ||
vec3 | end | ||
) |
This function executes the Collision(Sweep) Test test of a sphere. The sweep test is made by extruding the sphere from a start point to an end point and checking if there is some object inside the extrusion. It returns true if the sweep test has success, false otherwise.
radius | sphere radius. |
start | start point. |
end | end point. |
void PhysicsCreateBody | ( | string | coltype, |
float | mass, | ||
vec3 | props | ||
) |
This function creates a physics rigid body and associates it to 'this object'.
coltype | type of collider. For now 4 types of collider can be specified:
|
mass | mass of the body. If it is 0.0 the body is considered static (like it happens for MeshObjects). |
props(optional) | is a vector containing 3 scalars representing 3 physical props of the body:
|
void PhysicsCreateCharacter | ( | ) |
This function creates a character into the physics subsystem and associates it to this object. The Characters of the physics subsystem are specifically designed for intergrating the game-like character control with a realistic physical simulation.
void PhysicsCreateCharacter | ( | float | slopeLimit | ) |
This function creates a character into the physics subsystem and associates it to this object. The Characters of the physics subsystem are specifically designed for intergrating the game-like character control with a realistic physical simulation.
slopeLimit:The | maximum slope which the character can walk up. From 0.0 (planar slope) to 1.0 (maximum slope, 180 degree). The limit is expressed as the cosine of desired limit angle. A value of 0.0 disables this feature. Default value is 0.707 ( cos(45) ) |
void PhysicsCreateRagdoll | ( | ) |
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.
The Vehicles of the physics subsystem are specifically designed for easly simulating physical vehicle behavior.
vechicleBody | name of the node of this object containing the body of the vehicle. |
frontWheels | string containing the list of names of the nodes of this object containing vehicle front wheels. the names must be separated by symbol ',' . |
backWheels | string containing the list of names of the nodes of this object containing vehicle back wheels. the names must be separated by symbol ',' . |
props | string containing the list of properties of the vehicle, the properties must be separated by symbol ',':
|
Example
vec3 PhysicsGetCharacterDims | ( | ) |
string PhysicsGetCollidedObject | ( | ) |
This function returns the name of the object collided in a previous sweep test.
If no object has collided it returns "null" string.
bool PhysicsGetCollideFlag | ( | ) |
This function returns true if the physics object associated with this object can collide, false otherwise.
The function has effects on all type of physics objects:
vec3 PhysicsGetCollisionNormal | ( | ) |
This function returns the collision normal of the object collided in a previous sweep test.
vec3 PhysicsGetObjectPos | ( | ) |
float PhysicsGetVehicleRPM | ( | ) |
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 parent node world positions.
The sweep test is made by extruding the capsule, created from node and parent node positions, along a displace 3d vector checking if there is some object inside the extrusion. It returns true if the sweep test has success, false otherwise.
obj | name of the object containing the node you want to execute the seep test. |
node | name of the node you want to execute sweep test |
radius | radius of the capsule of the sweep test. |
disp | 3d vector containing the displace of the capsule. |
bool PhysicsObjectIsSleeping | ( | ) |
This functions returns true if the state of physics object associated with this object is set to sleeping, otherwise returns false.
When a body does not move for a period of time, it is assumed that it will remain immobile until an external force throws it out of equilibrium, in this case we say the body is sleeping. Usually physics system does it automatically but sometime it is possible you would to force it. This function lets you to know the sleeping state of the body.
void PhysicsObjectSleep | ( | ) |
This functions sets the state of the body associated with this object to sleeping.
When a body does not move for a period of time, it is assumed that it will remain immobile until an external force throws it out of equilibrium, in this case we say the body is sleeping. Usually physics system does it automatically but sometime it is possible you would to force it. This function lets you to force the state of the body to sleep.
void PhysicsObjectWakeUp | ( | ) |
This functions sets the state of the body associated with this object to wake up.
You can use it when you want to wake up a sleeping body.
void PhysicsRagdollSleep | ( | ) |
This functions sets the state of a ragdoll associated with this object (i.e. the state the all the ragdoll capsules) to sleeping.
void PhysicsRagdollWakeUp | ( | ) |
This functions sets the state of a ragdoll associated with this object (i.e. the state the all the ragdoll capsules) to wake up.
void PhysicsResetCollideFlag | ( | ) |
This function sets to false the collide flag of physics object associated with this object.
So, calling this function, the object doesn't collide with others. The function has effects on all type of physics objects:
void PhysicsResetRagdollCollideFlag | ( | ) |
void PhysicsSetCharacterDims | ( | vec3 | dims | ) |
This function sets the dimensions of the capsule of a physics character associated to this object.
dims | dimensions to set. |
void PhysicsSetCharacterGravity | ( | float | gravity | ) |
This function sets the amount of the gravity applied on the physics character associated with this object.
By default, gravity has the same value of gravity applied on all the other physics objects.
gravity | the amount of gravity to apply to character. |
void PhysicsSetCollideFlag | ( | ) |
This function sets to true the collide flag of physics object associated with this object.
So, calling this function, the object collide with others. The function has effects on all type of physics objects:
void PhysicsSetObjectPos | ( | vec3 | pos | ) |
void PhysicsSetRagdollCollideFlag | ( | ) |
void PhysicsVehicleControl | ( | float | steerAngle, |
float | acc, | ||
bool | handbrake | ||
) |
This function moves this object if it is associated with a physics vehicle.
steerAngle | the rotation angle, expressed in degree, of the steering wheel. Negative values mean turning left, positive values mean turning right. |
acc | amount of accelleration pedal or brake pedal pression. Values can be into the interval [-1.0,1.0]. Negative values mean brake pedal pression, positive values mean accelleration pedal pression. |
handbrake | true if hadbrake is pressed, false otherwise. |
void PlayAnimation | ( | int | channel, |
bool | loop | ||
) |
This function plays all the animations of a channel.
Usually It is used in conjunction of BlendCurrentAnimation that sets the weight factor of an animation and assigns it to a channel.
channel | the id of the channel animation belong. |
loop | true if the animaion must loop, false otherwise. |
void PlayMusic | ( | string | music, |
int | channel | ||
) |
This function play a music on a given channel.
music | the music filename. |
channel | the channel index. Must be form 0 to 3. |
void PlaySound | ( | string | sound, |
bool | loop | ||
) |
This function plays a sound given its filename.
sound | the sound filename. |
loop | true if the sound must loop. Otherwise false. |
void PlaySoundGlobal | ( | string | sound, |
bool | loop | ||
) |
This function plays a global sound given its filename.
sound | the sound filename. |
loop | true if the sound must loop. Otherwise false. |
float Rand | ( | int | res | ) |
bool ReceivedMessage | ( | string | msg | ) |
void ResetObjectFlags | ( | string | objname, |
string | flags | ||
) |
void ResetSubWidgetFlag | ( | string | sw, |
string | flags | ||
) |
This function resets( sets to false) the flags of a widget that is a child of this one.
The flags must be composed into a string of names separated by '|' symbol (for example: "flag1|flag2|flag3").
sw | the name of the subwidget |
flags | list of the flags to reset |
void RestartLevel | ( | ) |
void Save | ( | string | text, |
string | path | ||
) |
This function saves a string into a text file.
text | the string to save |
path | the path of the file in which to save |
float ScalarInterpolate | ( | float | s1, |
float | s2, | ||
float | t | ||
) |
This function returns the result of the linear interpolation between two input float numbers, given the parameter t.
s1 | first scalar |
s2 | second scalar |
t | Interpolation parameter. It must be between 0.0 and 1.0. |
vec3 ScreenToWorld | ( | vec3 | p | ) |
This function transforms a point from screen coordinates space to world coordinates space. This function is useful, for example, when you need to check if the user have clicked on a 3d object with the mouse cursor.
p | the input point |
void SendMessageBroad | ( | string | dest, |
string | name, | ||
string | content | ||
) |
void SendMessageBroad | ( | string | dest, |
string | name, | ||
string | content, | ||
float | delay | ||
) |
This function send a message to all active objects.
dest | is the destination object name |
name | is the name of the message |
content | is the content of the message |
delay | is the time delay you want message must be sent. It is expressed in milliseconds. A value < 0.0 means that message is sent in immediate mode (i.e. just it is a normal function), A value equal to 0.0 means the message is sent in the next message processing phase (this is the default value and it is just as if delay param is omitted) |
void SendMessageGUI | ( | string | name, |
string | content | ||
) |
This function sends a message to the main widget of the GUI.
name | is the name of the message |
content | is the content of the message |
void SendMessageGUI | ( | string | name, |
string | content, | ||
float | delay | ||
) |
This function sends a message to the main Widget of the GUI.
name | is the name of the message |
content | is the content of the message |
delay(available | from 1.03.01) is the time delay you want message must be sent. It is expressed in milliseconds. A value < 0.0 means that message is sent in immediate mode (i.e. just it is a normal function), A value equal to 0.0 means the message is sent in the next message processing phase (this is the default value and it is just as if delay param is omitted) |
void SendMessageHUD | ( | string | name, |
string | content | ||
) |
This function sends a message to the main widget of the HUD.
name | is the name of the message |
content | is the content of the message |
void SendMessageHUD | ( | string | name, |
string | content, | ||
float | delay | ||
) |
This function sends a message to the main Widget of the HUD.
name | is the name of the message |
content | is the content of the message |
delay(available | from 1.03.01) is the time delay you want message must be sent. It is expressed in milliseconds. A value < 0.0 means that message is sent in immediate mode (i.e. just it is a normal function), A value equal to 0.0 means the message is sent in the next message processing phase (this is the default value and it is just as if delay param is omitted) |
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 on a range of influence and a specified class.
name | is the name of the message |
content | is the content of the message |
range | is the range of influence. If 0.0 the range is considered infinite. |
class | is the class of the receivers. If NULL is specified, all objects are considered. If delay is specified class is automatically set to null |
void SendMessageMulti | ( | string | name, |
string | content, | ||
float | range, | ||
float | delay | ||
) |
This function send a message to more than one active object. The receiver objects are choosen basing on a range of influence and a specified class.
name | is the name of the message |
content | is the content of the message |
range | is the range of influence. If 0.0 the range is considered infinite. |
class | is the class of the receivers. If NULL is specified, all objects are considered. If delay is specified class is automatically set to null |
delay | is the time delay you want message must be sent. It is expressed in milliseconds. A value < 0.0 means that message is sent in immediate mode (i.e. just it is a normal function), A value equal to 0.0 means the message is sent in the next message processing phase (this is the default value and it is just as if delay param is omitted) |
void SendMessageSingle | ( | string | dest, |
string | name, | ||
string | content | ||
) |
void SendMessageSingle | ( | string | dest, |
string | name, | ||
string | content, | ||
float | delay | ||
) |
This function send a message to a single active object given its name.
dest | is the destination object name |
name | is the name of the message |
content | is the content of the message |
delay | is the time delay you want message must be sent. It is expressed in milliseconds. A value < 0.0 means that message is sent in immediate mode (i.e. just it is a normal function), A value equal to 0.0 means the message is sent in the next message processing phase (this is the default value and it is just as if delay param is omitted) |
void SetAnimationBlendX | ( | int | channel, |
string | animName, | ||
float | value | ||
) |
This function assigns a blend float value to a blended animation in X direction.
This means that if blended animation is 1D it affects to the blending of source animations, if blended animation is 2D it affects the blending of source animations of a row of 2D blending table.
channel | ID of the channel to which add the animation |
animName | name of the blended animation to set value |
value | float value to set ranging from 0 to 1 |
void SetAnimationBlendY | ( | int | channel, |
string | animName, | ||
float | value | ||
) |
This function assigns a blend float value to a blended animation in Y direction.
This means that if blended animation is 1D it DOESN'T affects to the blending of source animations, if blended animation is 2D it affects the blending of source animations of a column of 2D blending table.
channel | ID of the channel to which add the animation |
animName | name of the blended animation to set value |
value | float value to set ranging from 0 to 1 |
void SetAnimationChannelMask | ( | int | channel, |
string | maskname | ||
) |
This function assigns a mask to a given channel.
The mask is identified by its name. Animation channel masks are described inside modelscript files.
channel | animation channel ID to pause. |
maskname | name of the mask to assign. |
void SetAnimationChannelSpeed | ( | int | channel, |
float | speed | ||
) |
void SetEngineParam | ( | string | param, |
string | value | ||
) |
This function sets the value of a specified param of the engine and its subsystems: Render, Physics, Audio.
param | name of the param to set. |
value | value to set. |
void SetLevelParam | ( | string | param, |
string | value | ||
) |
This function sets the value of a specified param of the current scene.
param | name of the param to set. |
value | value to set. |
void SetObjectFlags | ( | string | objname, |
string | flags | ||
) |
bool SetObjectParam | ( | string | objname, |
string | paramname, | ||
string | paramvalue | ||
) |
This function sets the value of the parameter of an object given as string.
objname | name of the object |
paramname | name of the parameter to retrieve. |
paramvalue | value of the parameter to set (must be a string) |
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 widget if this is a widget script.
param | name of the param to set. |
value | value to set. |
void SetSource | ( | float | gain, |
float | range | ||
) |
This function creates a sound source and assign it to this object.
gain | sound source volume |
range | sound source range of influence |
void SetSourcePitch | ( | float | pitch | ) |
This function sets the sound source pitch.
Useful to simulate the noise of a car engine that accellerates.
pitch | sound source pitch. |
void SetSourceRange | ( | float | range | ) |
This function sets the sound source range of influence.
range | sound source range of influence. |
void SetSourceVolume | ( | float | volume | ) |
This function sets the sound source volume.
volume | sound source volume. |
void SetSubWidgetFlag | ( | string | sw, |
string | flags | ||
) |
This function sets (to true) the flags of a widget that is a child of this one.
The flags must be composed into a string of names separated by '|' symbol (for example: "flag1|flag2|flag3").
sw | the name of the subwidget |
flags | list of the flags to set |
void SetSubWidgetOpacity | ( | string | widget, |
float | opacity | ||
) |
This function sets the opacity level of the tree starting from the child widget of this widget.
The Opacity of a widget can be set also with SetParam() and param "opacity", but in this case only the widget opacity is modified, not the opacity of whole subtree.
widget | name of the child widget to change opacity. |
opacity | opacity value to set |
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.
The param is identified by its name. The value must be always a string so it must be converted before assign it.
widget | name of the child widget to destroy. |
param | name of the param to set |
value | value to assign to the param |
void SetSubWidgetPos | ( | string | widget, |
float | x, | ||
float | y | ||
) |
This function assigns a new position to the child widget of this widget.
Calling It is equivalent to call the SetSubWidgetParam and specify the pos param. Take in mind that the position of the child widget is always relative to the position of parent widget.
widget | name of the child widget to assign position. |
x | value of the new x coordinate |
y | value of the new y coordinate |
void SetTimeScale | ( | float | timeMul | ) |
void SetWidgetOpacity | ( | float | opacity | ) |
This function sets the opacity level of the tree starting from this widget.
The Opacity of a widget can be set also with SetParam() and param "opacity", but in this case only the widget opacity is modified, not the opacity of whole subtree.
opacity | opacity value to set |
void ShowCursor | ( | bool | show | ) |
void ShowParentWidget | ( | bool | show | ) |
This function shows/hides the parent of this widget.
show | true if you want to show the widget, false otherwise. |
void ShowSubWidget | ( | string | widget, |
bool | show | ||
) |
This function shows/hides a child of this widget given its name.
Take in mind that this function has effect on the whole subtree of the widget, if it is a composed widget.
widget | name of the widget to show/hide. |
show | true if you want to show the widget, false otherwise. |
void ShowWidget | ( | bool | show | ) |
This function shows/hides this widget.
If this widget is composed by other widgets, this function has effect also on them, i.e. on all this widget subtree.
show | true if you want to show the widget, false otherwise. |
float Sin | ( | float | angle | ) |
This function returns the sine value of a given angle. The angle value is expressed in degrees.
angle | value of the input angle expressed in degrees. |
void SpawnObject | ( | string | prefabFilename, |
vec3 | pos, | ||
vec3 | angles | ||
) |
void StopAnimation | ( | int | channel | ) |
This function stops an animation channel, i.e. it stops all the animations of the channel.
It also rewinds all channel animations and sets all channel animation weights to 0.0.
channel | animation channel ID to stop. |
void StopMusic | ( | int | channel | ) |
void StopSound | ( | ) |
void StopSoundGlobal | ( | ) |
string String | ( | float | f | ) |
string String | ( | bool | b | ) |
This function convert an integer, a float, a boolean, a 3d vector or a 4d vector value into a string.
b | input boolean |
string String | ( | int | i | ) |
This function convert an integer, a float, a boolean, a 3d vector or a 4d vector value into a string.
i | input integer |
string String | ( | vec3 | v3 | ) |
This function convert an integer, a float, a boolean, a 3d vector or a 4d vector value into a string.
v3 | input 3d vector |
string String | ( | vec4 | v4 | ) |
This function convert an integer, a float, a boolean, a 3d vector or a 4d vector value into a string.
v4 | input 4d vector |
vec3 String2Vec3 | ( | string | s | ) |
This function convert a string into a 3d vector.
s | input string |
vec4 String2Vec4 | ( | string | s | ) |
This function convert a string into a 4d vector.
s | input string |
vec3 Vec3 | ( | float | x, |
float | y, | ||
float | z | ||
) |
vec4 Vec4 | ( | float | x, |
float | y, | ||
float | z, | ||
float | w | ||
) |
vec3 VectorInterpolate | ( | vec3 | s1, |
vec3 | s2, | ||
float | t | ||
) |
This function returns the result of the linear interpolation between two input 3d Vectors, given the parameter t.
s1 | first vector |
s2 | second vector |
t | Interpolation parameter. It must be between 0.0 and 1.0. |
float VectorLen | ( | vec3 | v | ) |
This function returns the Length of a 3d vector.
v | Input vector |
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. It is equal to multiply a 3d point with a rotation matrix.
v | 3d point to rotate |
angle | angle of rotation |
axis | axis of rotation |
vec3 VectorToAngles | ( | vec3 | v | ) |
This function returns the orientation of a given 3d vector expressed as the float triple yaw,pitch,roll where:
yaw
is the angle around Y axispitch
is the angle around X axisroll
is the angle around Z axisv | the input 3d vector |
vec3 WorldToScreen | ( | vec3 | p | ) |
This function transforms a point from world coordinates space to screen coordinates space.
It is the inverse operation of ScreenToWorld function. This function is useful if you want to put a widget (for example a text label) near the projection on screen of a 3d object.
p | the input point |