Printable Version

Function and Foundation Reference



Table of Contents

  1. Function Reference
    1. General
    2. Entity
    3. Node
    4. Scenegraph
    5. Lighting
    6. Camera
    7. Shape
    8. /2010.11.25: Particle System/
    9. Physics
    10. /2010.11.25: Destruction/
    11. Spline
    12. Animation
    13. Overlays
    14. Sound
    15. Input
    16. XML
    17. Network
    18. Callbacks
  2. Foundation Reference
    1. Scenegraph
    2. Input

Function Reference

General Function Reference


print Description
Print to console

Definition
function print(arg1, ...)

Arguments
any typearg1variable to print
any type...variable to print




source

Description
Source script file

Definition
function source(filename)

Arguments
stringfilenamename of script file




requestExit

Description
Request application to exit at the end of this frame

Definition
function requestExit()




renderText

Description
Render text to viewport
/2010.11.25: See asciiToUtf8 to convert to utf8/

Definition
function renderText(float x, float y, float size, string str)

Arguments
floatxx position [0, 1]
floatyy position [0, 1]
floatsizefont size
stringstrstring to print




setTextColor

Description
Set the text color to be used for the following renderText calls

Definition
function setTextColor(float r, float g, float b, float a)

Arguments
floatrred color component [0, 1]
floatggreen color component [0, 1]
floatbblue color component [0, 1]
floataalpha (opacity) [0, 1]




setTextBold

Description
Set the text boldness to be used for the following renderText calls

Definition
function setTextBold(boolean isBold)

Arguments
booleanisBoldbold state




setTextAlignment

Description
Set the text alignment to be used for the following renderText calls

Definition
function setTextAlignment(integer alignment)

Arguments
integeralignmentalignment (RenderText.ALIGN_LEFT, RenderText.ALIGN_CENTER or RenderText.ALIGN_RIGHT)




setTextWrapWidth

Description
Set the text wrap width to be used for the following renderText calls

Definition
function setTextWrapWidth(float wrapWidth)

Arguments
floatwrapWidthwrap width

Notes
since v4.1.4




unicodeToUtf8

Description
Converts an unicode value to an utf8 string

Definition
function unicodeToUtf8(integer unicode)

Arguments
integerunicodeunicode value
Return Values
stringutf8stringutf8 formated string representing the unicode

Notes
since v4.1.4




utf8Strlen

Description
Returns the length of an utf8 formated string

Definition
function utf8Strlen(string utf8string)

Arguments
stringutf8stringutf8 formated string
Return Values
integerlengthlength of the given string

Notes
since v4.1.4




utf8Substr

Description
Returns a sub string of an utf8 formated string

Definition
function utf8Substr(string utf8string, integer startIndex, integer length)

Arguments
stringutf8stringutf8 formated string
integerstartIndexzero based start index
integerlengthmaximal length of the sub string (optional)
Return Values
stringsubStringutf8 formated sub string

Notes
since v4.1.4




setFog

Description
Set fog properties

Definition
function setFog(string fogType, float startDistanceOrDensity, float endDistance, float r, float g, float b)

Arguments
stringfogTypefog type ("none", "linear", "exp" or "exp2")
floatstartDistanceOrDensitystart distance (linear) or density (exp and exp2)
floatendDistanceend distance (linear)
floatrcolor r
floatgcolor g
floatbcolor b




setVolumeFog

Description
Set volume fog properties

Definition
function setVolumeFog(string fogType, float startDistanceOrDensity, float endDistance, float yPlane, float r, float g, float b)

Arguments
stringfogTypefog type ("none", "linear", "exp" or "exp2")
floatstartDistanceOrDensitystart distance (linear) or density (exp and exp2)
floatendDistanceend distance (linear)
floatyPlaney plane value
floatrcolor r
floatgcolor g
floatbcolor b




wrapMousePosition

Description
Wrap mouse position

Definition
function wrapMousePosition(float x, float y)

Arguments
floatxx coord [0, 1]
floatyy coord [0, 1]




setShowMouseCursor

Description
Set show mouse cursor

Definition
function setShowMouseCursor(boolean state)

Arguments
booleanstateenable state




setCaption

Description
Set caption

Definition
function setCaption(string caption)

Arguments
stringcaptionapplication caption




loadI3DFile

Description
Load I3D file

Definition
function loadI3DFile(string filename)

Arguments
stringfilenamei3d filename
Return Values
integerrootNodeIdid of root node




project

Description
Transform vector from world space into screen space

Definition
function project(float wx, float wy, float wz)

Arguments
floatwxworld space x coordinate
floatwyworld space y coordinate
floatwzworld space z coordinate

Return Values
floatsxscreen space x coordinate
floatsyscreen space y coordinate
floatszscreen space z coordinate




unProject

Description
Transform vector from screen space into world space

Definition
function unProject(float sx, float sy, float sz)

Arguments
floatsxscreen space x coordinate
floatsyscreen space y coordinate
floatszscreen space z coordinate

Return Values
floatwxworld space x coordinate
floatwyworld space y coordinate
floatwzworld space z coordinate




addTimer

Description
Adds timer callback function

Definition
function addTimer(float time, string timerFunctionCallback, object instance)

Arguments
floattimetime in milliseconds
stringtriggerFunctionCallbacktrigger function callback
objectinstanceinstance object (optional)

Return Values
integertimerIdtimer id




setTimerTime

Description
Set timer interval time

Definition
function setTimerTime(integer timerId, float time)

Arguments
integertimerIdtimer id
floattimetime in milliseconds




saveScreenshot

Description
Save screenshot

Definition
function saveScreenshot(string filename)

Arguments
stringfilenamefilename




getAppBasePath

Description
Get application base path

Definition
function getAppBasePath()

Return Values
stringappBasePathapplication base path




getUserProfileAppPath

Description
Get user profile application path

Definition
function getUserProfileAppPath()

Return Values
stringgetUserProfileAppPathuser profile application path




copyFile

Description
Get copy file

Definition
function copyFile(string sourceFile, string destinationFile, boolean overwrite)

Arguments
stringsourceFilesource filename
stringdestinationFiledestination filename
booleanoverwriteoverwrite file if it already exists




getFiles

Description
Get all files of a directory

Definition
function getFiles(string path, string fileFunctionCallback, object instance)

Arguments
stringpathpath
stringfileFunctionCallbackfile function callback
objectinstanceinstance object (optional)

Return Values
integernumFilesnumber of files




Entity Function Reference


delete

Description
Delete Entity/Object

Definition
function delete(integer objectId)

Arguments
integerobjectIdobject id



getClassName

Description
Get class name of object

Definition
function getClassName(integer objectId)

Arguments
integerobjectIdobject id

Return Values
stringclassNameclass name of object




addDeleteListener

Description
Add a delete listener

Definition
function addDeleteListener(integer objectId, string deleteFunctionCallback, object targetObject)

Arguments
integerobjectIdobject id
stringdeleteFunctionCallbackdelete listener function callback, is called when the entity is deleted
objecttargetObjecttarget object (optional), the callback function is called as a member function of targetObject

Return Values
integerlistenerIdid to the created callback, must be given to removeDeleteListener




removeDeleteListener

Description
Remove a delete listener. Note: it is important to call removeDeleteListener for each addDeleteListener call to avoid memory leaks

Definition
function removeDeleteListener(integer objectId, integer listenerId)

Arguments
integerobjectIdobject id
integerlistenerIdid of the delete listener




Node Function Reference


getParent

Description
Get parent id

Definition
function getParent(integer objectId)

Arguments
integerobjectIdobject id

Return Values
integerparentIdparent id




link

Description
Link node to another node

Definition
function link(integer parentNodeId, integer childNodeId)

Arguments
integerparentNodeIdid of parent node
integerchildNodeIdid of child node




unlink

Description
Unlink node from parent

Definition
function unlink(integer objectId)

Arguments
integerobjectIdobject id




getNumOfChildren

Description
Get number of children

Definition
function getNumOfChildren(integer objectId)

Arguments
integerobjectIdobject id

Return Values
integernumOfChildrennumber of children




getChildAt

Description
Get child id at given index

Definition
function getChildAt(integer objectId, integer index)

Arguments
integerobjectIdobject id
integerindexindex of child

Return Values
integerchildIdid of child node




getChild

Description
Get child id

Definition
function getChild(integer objectId, string childName)

Arguments
integerobjectIdobject id
stringchildNamechild name

Return Values
integerchildIdid of child node




getName

Description
Get object name

Definition
function getName(integer objectId)

Arguments
integerobjectIdobject id

Return Values
stringobjectNameobject name




setName

Description
Set object name

Definition
function setName(integer objectId, string objectName)

Arguments
integerobjectIdobject id
stringobjectNamenew object name




removeChildAt

Description
Remove child at given index

Definition
function removeChildAt(integer objectId, integer index)

Arguments
integerobjectIdobject id
integerindexindex of child




Scenegraph Function Reference


createTransformGroup

Description
Create transform group

Definition
function createTransformGroup(string transformName)

Arguments
stringtransformNamename of transform object

Return Values
integertransformIdid of transform object




setTranslation

Description
Set translation of a transform object

Definition
function setTranslation(integer transformId, float x, float y, float z)

Arguments
integertransformIdid of transform object
floatxx value of translation
floatyy value of translation
floatzz value of translation




getTranslation

Description
Get translation of a transform object

Definition
function getTranslation(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
floatxx value of translation
floatyy value of translation
floatzz value of translation




getWorldTranslation

Description
Get world translation of a transform object

Definition
function getWorldTranslation(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
floatxx value of world translation
floatyy value of world translation
floatzz value of world translation




setRotation

Description
Set euler rotation of a transform object. Order ZY'X''

Definition
function setRotation(integer transformId, float x, float y, float z)

Arguments
integertransformIdid of transform object
floatxx value of rotation (radian units)
floatyy value of rotation (radian units)
floatzz value of rotation (radian units)




getRotation

Description
Get rotation of a transform object

Definition
function getRotation(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
floatxx value of rotation (radian units)
floatyy value of rotation (radian units)
floatzz value of rotation (radian units)




getWorldRotation

Description
Get world rotation of a transform object

Definition
function getWorldRotation(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
floatxx value of world rotation (radian units)
floatyy value of world rotation (radian units)
floatzz value of world rotation (radian units)




setDirection

Description
Set the direction of an object, the positive z-axis points towards the given direction. The y-axis lies in the direction-up-plane.

Definition
function setDirection(integer transformId, float x, float y, float z, float upX, float upY, float upZ)

Arguments
integertransformIdid of transform object
floatxx value of direction
floatyy value of direction
floatzz value of direction
floatupXx value of up vector
floatupYy value of up vector
floatupYz value of up vector




setScale

Description
Set scale of a transform object

Definition
function setScale(integer transformId, float x, float y, float z)

Arguments
integertransformIdid of transform object
floatxx value of scale
floatyy value of scale
floatzz value of scale




getScale

Description
Get scale of a transform object

Definition
function getScale(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
floatxx value of scale
floatyy value of scale
floatzz value of scale




setVisibility

Description
Set transform object visibility

Definition
function setVisibility(integer transformId, boolean visibility)

Arguments
integertransformIdid of transform object
booleanvisibilityvisibility state




getVisibility

Description
Get transform object visibility

Definition
function getVisibility(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
booleanvisibilityvisibility state




clone

Description
Clone scenegraph object

Definition
function clone(integer objectId, boolean groupUnderParent)

Arguments
idobjectIdid of scenegraph object
booleangroupUnderParentif true the clone will be linked to the the same parent as objectId, otherwise it is not linked to the scenegraph

Return Values
idcloneIdid of clone object




setRootNode

Description
Set scenegraph root node

Definition
function setRootNode(integer rootNodeId, /2010.11.25: integer viewportIndex/)

Arguments
integerrootNodeIdid of new root node
integerviewportIndexthe index of the viewport [0-7]




getRootNode

Description
Get scenegraph root node used by the given viewport

Definition
function getRootNode(/2010.11.25: integer viewportIndex/)

Arguments
integerviewportIndexthe index of the viewport [0-7]




localToWorld

Description
Local space to world space transformation

Definition
function localToWorld(integer transformId, float x, float y, float z)

Arguments
integertransformIdid of transform object
floatxx value of local position
floatyy value of local position
floatzz value of local position

Return Values
floatxx value of world position
floatyy value of world position
floatzz value of world position




localDirectionToWorld

Description
Local space to world space transformation, only direction without translation

Definition
function localDirectionToWorld(integer transformId, float x, float y, float z)

Arguments
integertransformIdid of transform object
floatxx value of local direction
floatyy value of local direction
floatzz value of local direction

Return Values
floatxx value of world direction
floatyy value of world direction
floatzz value of world direction




worldToLocal

Description
World space to local space transformation

Definition
function worldToLocal(integer transformId, float x, float y, float z)

Arguments
integertransformIdid of transform object
floatxx value of world position
floatyy value of world position
floatzz value of world position

Return Values
floatxx value of local position
floatyy value of local position
floatzz value of local position




worldDirectionToLocal

Description
World space to local space transformation, only direction without translation

Definition
function worldDirectionToLocal(integer transformId, float x, float y, float z)

Arguments
integertransformIdid of transform object
floatxx value of world direction
floatyy value of world direction
floatzz value of world direction

Return Values
floatxx value of local direction
floatyy value of local direction
floatzz value of local direction




getAnimCharacterSet

Description
Get animation character set id

Definition
function getAnimCharacterSet(integer objectId)

Arguments
integerobjectIdobject id

Return Values
integeranimIdanimation character set id




setUserAttribute

Description
Set user attribute value

Definition
function setUserAttribute(integer objectId, string attributeName, string typeName, integer/float/boolean/string value)

Arguments
integerobjectIdobject id
stringattributeNamename of the user attribute
stringtypeNamename of the type ("Integer", "Float", "String", "Boolean")
integer/float/boolean/stringvaluevalue of the user attribute, must match typeName




getUserAttribute

Description
Get user attribute value

Definition
function getUserAttribute(integer objectId, string attributeName)

Arguments
integerobjectIdobject id
stringattributeNamename of the user attribute

Return Values
integer/float/boolean/stringattributeValuevalue of the user attribute, return type is the type of the attribute. Returns nil if attributeName doest not exist




setObjectMask

Description
Set object mask

Definition
function setObjectMask(integer objectId, integer mask)

Arguments
integerobjectIdobject id
integermaskthe object mask to set




getObjectMask

Description
Get object mask

Definition
function getObjectMask(integer objectId)

Arguments
integerobjectIdobject id

Return Values
integermaskthe object mask




getTerrainHeightAtWorldPos

Description
get the terrain height at the given position

Definition
function getTerrainHeightAtWorldPos(integer terrainId, float x, float y, float z)

Arguments
integerterrainIdterrain id
floatxx value of the world position
floatyy value of the world position
floatzz value of the world position

Return Values
floatheightValueheight of the terrain at the given position



Lighting Function Reference


setAmbientColor

Description
Set global ambient color

Definition
function setAmbientColor(float r, float g, float b)

Arguments
floatrred value of ambient color
floatggreen value of ambient color
floatbblue value of ambient color




getLightDiffuseColor

Description
Get diffuse color of a light

Definition
function getLightDiffuseColor(integer lightId)

Arguments
integerlightIdid of light

Return Values
floatrred value of diffuse color
floatggreen value of diffuse color
floatbblue value of diffuse color




setLightDiffuseColor

Description
Set diffuse color of a light

Definition
function setLightDiffuseColor(integer lightId, float r, float g, float b)

Arguments
integerlightIdid of light
floatrred value of diffuse color
floatggreen value of diffuse color
floatbblue value of diffuse color




getLightSpecularColor

Description
Get specular color of a light

Definition
function getLightSpecularColor(integer lightId)

Arguments
integerlightIdid of light

Return Values
floatrred value of specular color
floatggreen value of specular color
floatbblue value of specular color




setLightSpecularColor

Description
Set specular color of a light

Definition
function setLightSpecularColor(integer lightId, float r, float g, float b)

Arguments
integerlightIdid of light
floatrred value of specular color
floatggreen value of specular color
floatbblue value of specular color




getLightRange

Description
Get range of a light

Definition
function getLightRange(integer lightId)

Arguments
integerlightIdid of light

Return Values
floatrangelight range




setLightRange

Description
Set range of a light

Definition
function setLightRange(integer lightId, float range)

Arguments
integerlightIdid of light
floatrangelight range




Camera Function Reference


createCamera

Description
Create camera

Definition
function createCamera(integer cameraId /2010.11.25: string cameraName/, float fovy, float nearClip, float farClip)

Arguments
stringcameraNamecamera name
floatfovyfield of view (degree)
floatnearClipnear clip
floatfarClipfar clip




setCamera

Description
Set currently used camera by the given viewport

Definition
function setCamera(integer cameraId, /2010.11.25: integer viewportIndex/)

Arguments
integercameraIdnew camera id
integerviewportIndexthe index of the viewport [0-7]




getCamera

Description
Get currently used camera by the given viewport

Definition
function getCamera(/2010.11.25: integer viewportIndex/)

Arguments
integerviewportIndexthe index of the viewport [0-7]

Return Values
integercurrentCameraIdcurrent camera id




2010.11.25: setViewport

Description
Set the dimensions of the given viewport

Definition
function setViewport(integer viewportIndex, float left, float top, float width, float height)

Arguments
integerviewportIndexthe index of the viewport [0-7]
floatleftthe start position from the left side [0-1]
floattopthe start position from the top side [0-1]
floatwidththe width of the viewport [0-1]
floatheightthe height of the viewport [0-1]

Notes
since v4.1.5




setFovy

Description
Set the field of view angle

Definition
function setFovy(integer cameraId, float fovy)

Arguments
integercameraIdcamera id
floatfovyfield of view angle (degree)




getFovy

Description
Get the field of view angle

Definition
function getFovy(integer cameraId)

Arguments
integercameraIdcamera id

Return Values
floatfovyfield of view angle (degree)




setNearClip

Description
Set the near clip distance

Definition
function setNearClip(integer cameraId, float nearClip)

Arguments
integercameraIdcamera id
floatnearClipnear clip distance




getNearClip

Description
Get the near clip distance

Definition
function getNearClip(integer cameraId)

Arguments
integercameraIdcamera id

Return Values
floatnearClipnear clip distance




setFarClip

Description
Set the far clip distance

Definition
function setFarClip(integer cameraId, float farClip)

Arguments
integercameraIdcamera id
floatfarClipfar clip distance




getFarClip

Description
Get the far clip distance

Definition
function getFarClip(integer cameraId)

Arguments
integercameraIdcamera id

Return Values
floatfarClipfar clip distance




aimCamera

Description
Aim camera (spring/damper)

Definition
function aimCamera(integer cameraId, float x, float y, float z, float distance, float dt, float springStrength)

Arguments
integercameraIdcamera id
floatxtarget x coordinate
floatytarget y coordinate
floatztarget z coordinate
floatdistancedistance from target
floatdtdelta time
floatspringStrengthspring strength




Shape Function Reference


setShaderParameter

Description
Set shader parameter

Definition
function setShaderParameter(integer shapeId, string parameterName, float x, float y, float z, float w, boolean shared)

Arguments
integershapeIdshape id id
stringparameterNamethe name of the parameter
floatxx value
floatyy value
floatzz value
floatww value
booleansharedif true, the value is applied to all shapes with the same material



Physics Function Reference


simulatePhysics

Description
Enable/disable physics simulation

Definition
function simulatePhysics(boolean state)

Arguments
booleanstateenable simulation state




simulatePhysicsTimeScale

Description
Time scale of physics simulation

Definition
function simulatePhysicsTimeScale(float scale)

Arguments
floatscalephysics time scale




createCCT

Description
Create character controller (y axis capsule based)

Definition
function createCCT(integer transformId, float radius, float height, float stepOffset, float slopeLimit, float skinWidth, float collisionMask, float mass)

Arguments
integertransformIdid of transform object
floatradiusradius
floatheightheight
floatstepOffsetstep offset
floatslopeLimitslope limit
floatskinWidthskin width
integercollisionMaskcollision mask
floatmasscharacter mass [kg]

Return Values
integercharacterIndexcharacter index number




moveCCT

Description
Enqueue character movement

Definition
function moveCCT(integer characterIndex, float x, float y, float z, float collisionMasks)

Arguments
integercharacterIndexcharacter index number
floatxx value
floatyy value
floatzz value
floatcollisionMaskscollision masks




removeCCT

Description
Remove character controller

Definition
function removeCCT(integer characterIndex)

Arguments
integercharacterIndexcharacter index number




getCCTCollisionFlags

Description
Get character controller collision flags

Definition
function Engine.getCCTCollisionFlags(integer characterIndex)

Arguments
integercharacterIndexcharacter index number

Return Values
booleansideside flag
booleanupup flag
booleandowndown flag




raycastAll

Description
Raycast objects

Definition
function raycastAll(float x, float y, float z, float nx, float ny, float nz, string raycastFunctionCallback, float maxDistance)

Arguments
floatxorigin x
floatyorigin y
floatzorigin z
floatnxdirection x
floatnydirection y
floatnzdirection z
stringraycastFunctionCallbackraycast function callback
floatmaxDistancemax distance

Return Values
integernumShapesnumber of shapes hit




raycastClosest

Description
Raycast closest object

Definition
function raycastClosest(float x, float y, float z, float nx, float ny, float nz, string raycastFunctionCallback, float maxDistance)

Arguments
floatxorigin x
floatyorigin y
floatzorigin z
floatnxdirection x
floatnydirection y
floatnzdirection z
stringraycastFunctionCallbackraycast function callback
floatmaxDistancemax distance

Return Values
integernumShapesnumber of shapes hit




overlapSphere

Description
Overlap sphere objects

Definition
function overlapSphere(float x, float y, float z, float radius, string overlapFunctionCallback, object targetObject)

Arguments
floatxcenter x
floatycenter y
floatzcenter z
floatradiusradius
stringoverlapFunctionCallbackoverlap function callback
objecttargetObjecttarget object (optional), the callback function is called as a member function of targetObject

Return Values
integernumShapesnumber of shape overlaps




overlapBox

Description
Overlap box objects

Definition
function overlapBox(float x, float y, float z, float rx, float ry, float rz, float ex, float ey, float ez, string overlapFunctionCallback, object targetObject)

Arguments
floatxcenter x
floatycenter y
floatzcenter z
floatrxrotation x
floatryrotation y
floatrzrotation z
floatexextent x
floateyextent y
floatezextent z
stringoverlapFunctionCallbackoverlap function callback
objecttargetObjecttarget object (optional), the callback function is called as a member function of targetObject

Return Values
integernumShapesnumber of shape overlaps




addForce

Description
Add force to object

Definition
function addForce(integer transformId, float forceX, float forceY, float forceZ, float positionX, float positionY, float positionZ, boolean isPositionLocal)

Arguments
integertransformIdid of transform object
floatforceXforce x
floatforceYforce y
floatforceZforce z
floatpositionXposition x
floatpositionYposition y
floatpositionZposition z
booleanisPositionLocalis position local




addImpulse

Description
Add impulse to object

Definition
function addImpulse(integer transformId, float impulseX, float impulseY, float impulseZ, float positionX, float positionY, float positionZ, boolean isPositionLocal)

Arguments
integertransformIdid of transform object
floatimpulseXimpulse x
floatimpulseYimpulse y
floatimpulseZimpulse z
floatpositionXposition x
floatpositionYposition y
floatpositionZposition z
booleanisPositionLocalis position local




setJointDrive

Description
Set joint drive. Drives orientation if position drive or angular velocity if velocity drive.

Definition
function setJointDrive(integer transformId, float angle, float valueX, float valueY, float valueZ)

Arguments
integertransformIdid of transform object
floatangleorientation angle
floatvalueXorientation axis x or angular velocity x
floatvalueYorientation axis y or angular velocity y
floatvalueZorientation axis z or angular velocity z




createWheelShape

Description
Create wheel shape

Definition
function createWheelShape(integer transformId, float positionX, float positionY, float positionZ, float radius, float suspensionTravel, float spring, float damper, float mass)

Arguments
integertransformIdid of transform object
floatpositionXposition x
floatpositionYposition y
floatpositionZposition z
floatradiusradius
floatsuspensionTravelsuspension travel
floatspringspring
floatdamperdamper
floatmassmass

Return Values
integerwheelShapeIndexwheel shape index




setWheelShapeProps

Description
Set wheel shape properties

Definition
function setWheelShapeProps(integer transformId, integer wheelShapeIndex, float motorTorque, float brakeTorque, float steerAngle)

Arguments
integertransformIdid of transform object
integerwheelShapeIndexwheel shape index
floatmotorTorquemotor torque
floatbrakeTorquebrake torque
floatsteerAnglesteer angle




getWheelShapeAxleSpeed

Description
Get wheel shape axle speed

Definition
function getWheelShapeAxleSpeed(integer transformId, integer wheelShapeIndex)

Arguments
integertransformIdid of transform object
integerwheelShapeIndexwheelShapeIndex

Return Values
floataxleSpeedaxle speed




getWheelShapeContactPoint

Description
Get wheel shape contact point

Definition
function getWheelShapeContactPoint(integer transformId, integer wheelShapeIndex)

Arguments
integertransformIdid of transform object
integerwheelShapeIndexwheelShapeIndex

Return Values
floatxx position
floatyy position
floatzz position




getWheelShapePosition

Description
Get wheel shape position

Definition
function getWheelShapePosition(integer transformId, integer wheelShapeIndex)

Arguments
integertransformIdid of transform object
integerwheelShapeIndexwheelShapeIndex

Return Values
floatxx position
floatyy position
floatzz position




addTrigger

Description
Adds a trigger callback function

The transformId must have set the trigger flag and must be a static or a kinematic rigid body.
The given triggerFunctionCallback is called, whenever a dynamic or kinematic body enters or leaves the region defined by the trigger geometry. Static objects do not trigger an event.
See "trigger callback" in section "Custom callbacks"

Definition
function addTrigger(integer transformId, string triggerFunctionCallback, object targetObject)

Arguments
integertransformIdid of transform object
stringtriggerFunctionCallbacktrigger function callback
objecttargetObjecttarget object (optional), the callback function is called as a member function of targetObject




removeTrigger

Description
Removes trigger callback function

Definition
function removeTrigger(integer transformId)

Arguments
integertransformIdid of transform object




addContactReport

Description
Adds contact report callback function

Definition
function addContactReport(integer transformId, float forceThreshold, string contactReportFunctionCallback, object targetObject)

Arguments
integertransformIdid of transform object
floatforceThresholdforce threshold
stringtriggerFunctionCallbackcontact report function callback
objecttargetObjecttarget object (optional), the callback function is called as a member function of targetObject




removeContactReport

Description
Removes contact report callback function

Definition
function removeContactReport(integer transformId)

Arguments
integertransformIdid of transform object




getRigidBodyType

Description
Get rigid body type

Definition
function getRigidBodyType(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
stringtyperigid body type ("Static", "Dynamic", "Kinematic" or "NoRigidBody")




setRigidBodyType

Description
Set rigid body type

Definition
function setRigidBodyType(integer transformId, string type)

Arguments
integertransformIdid of transform object
stringtyperigid body type ("Static", "Dynamic", "Kinematic" or "NoRigidBody")




getCollisionMask

Description
Get collision mask

Definition
function getCollisionMask(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
integermaskcollision mask




setCollisionMask

Description
Set collision mask

Definition
function setCollisionMask(integer transformId, integer mask)

Arguments
integertransformIdid of transform object
integermaskcollision mask




getCenterOfMass

Description
Get center of mass

Definition
function getCenterOfMass(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
floatxx position
floatyy position
floatzz position




setCenterOfMass

Description
Set center of mass

Definition
function setCenterOfMass(integer transformId, float x, float y, float z)

Arguments
integertransformIdid of transform object
floatxx position
floatyy position
floatzz position




getMass

Description
Set mass

Definition
function getMass(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
floatmassmass




setMass

Description
Set mass

Definition
function setMass(integer transformId, float mass)

Arguments
integertransformIdid of transform object
floatmassmass



Spline Function Reference


getSplinePosition

Description
Get spline position

Definition
function getSplinePosition(integer shapeId, float time)

Arguments
integershapeIdid of curve shape object
floattimetime [0,1]

Return Values
floatxx coordinate
floatyy coordinate
floatzz coordinate




getSplineOrientation

Description
Get spline orientation

Definition
function getSplineOrientation(integer shapeId, float time, float upDirX, float upDirY, float upDirZ)

Arguments
integershapeIdid of curve shape object
floattimetime [0,1]
floatupDirXup direction x coordinate
floatupDirYup direction y coordinate
floatupDirZup direction z coordinate

Return Values
floatrxx rotation
floatryy rotation
floatrzz rotation




getSplineLength

Description
Get spline length

Definition
function getSplineLength(integer shapeId)

Arguments
integershapeIdid of curve shape object

Return Values
floatlengthlength of spline




getSplineNumOfCV

Description
Get number of spline control vertices

Definition
function getSplineNumOfCV(integer shapeId)

Arguments
integershapeIdid of curve shape object

Return Values
integernumnumber of spline control vertices




getSplineCV

Description
Get spline control vertex

Definition
function getSplineCV(integer shapeId, float time)

Arguments
integershapeIdid of curve shape object
integerindexcontrol vertex index

Return Values
floatxcontrol vertex x coordinate
floatycontrol vertex y coordinate
floatzcontrol vertex z coordinate




Animation Function Reference


getAnimCharacterSet

Description
Returns the character set driving the transform group

Definition
function getAnimCharacterSet(integer transformId)

Arguments
integertransformIdid of transform group

Return Values
integeridid of character set object, 0 if no character set is assigned to the transform group




enableAnimTrack

Description
Enable animation track

Definition
function enableAnimTrack(integer characterSetId, integer track)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number




disableAnimTrack

Description
Disable animation track

Definition
function disableAnimTrack(string characterSetId, integer track)

Arguments
stringcharacterSetIdname of CharacterSet object
integertracktrack number




isAnimTrackEnabled

Description
Is animation track enabled

Definition
function isAnimTrackEnabled(integer characterSetId, integer track)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number

Return Values
boolstateenable state




setAnimTrackSpeedScale

Description
Set animation track speed scale

Definition
function setAnimTrackSpeedScale(integer characterSetId, integer track, float speedScale)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number
floatspeedScalespeed scale




setAnimTrackLoopState

Description
Set animation track loop state

Definition
function setAnimTrackLoopState(integer characterSetId, integer track, bool loopState)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number
boolloopStateloop scale




setAnimTrackTime

Description
Set animation track time

Definition
function setAnimTrackTime(integer characterSetId, integer track, float time, /2010.11.25: boolean immediateUpdate/)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number
floattimetime
boolimmediateUpdate (optional)if set to true, the animation is updated immediately, otherwise it is only updated the next frame. For performance reasons, only set this to true if you really need the immediate update.




getAnimTrackTime

Description
Get animation track time

Definition
function getAnimTrackTime(integer characterSetId, integer track)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number

Return Values
floattimecurrent time




getAnimClipDuration

Description
Get the duration of the clip at the given index

Definition
function getAnimClipDuration(integer characterSetId, integer index)

Arguments
integercharacterSetIdid of CharacterSet object
integerindexclip index

Return Values
floatdurationclip duration




setAnimTrackBlendWeight

Description
Set animation track blend weight

Definition
function setAnimTrackBlendWeight(integer characterSetId, integer track, float weight)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number
floatweightblend weight




getAnimTrackBlendWeight

Description
Get animation track blend weight

Definition
function getAnimTrackBlendWeight(integer characterSetId, integer track)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number

Return Values
floatweightblend weight




getAnimClipIndex

Description
Returns the index of the clip with the given name

Definition
function getAnimClipIndex(integer characterSetId, string clipName)

Arguments
integercharacterSetIdid of CharacterSet object
stringclipNamethe name of the clip to find

Return Values
integerindexindex of the clip, -1 if clip was not found




assignAnimTrackClip

Description
Assign clip to animation track

Definition
function assignAnimTrackClip(integer characterSetId, integer track, float clipIndex)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number
floatclipIndexclip index number




isAnimTrackClipAssigned

Description
Is clip assigned to animation track

Definition
function isAnimTrackClipAssigned(integer characterSetId, integer track)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number

Return Values
boolstateassigned state




getAnimTrackAssignedClip

Description
Get animation track assigned clip index number

Definition
function getAnimTrackAssignedClip(integer characterSetId, integer track)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number

Return Values
floatclipIndexclip index number




clearAnimTrackClip

Description
Clear animation track clip assignment

Definition
function clearAnimTrackClip(integer characterSetId, integer track)

Arguments
integercharacterSetIdid of CharacterSet object
integertracktrack number




getAnimNumOfClips

Description
Get number of clips

Definition
function getAnimNumOfClips(integer characterSetId)

Arguments
integercharacterSetIdid of CharacterSet object

Return Values
floatclipsnumber of clips




Overlays Function Reference


createOverlay

Description
Create image overlay object

Definition
function createOverlay(string overlayName, string textureFilename)

Arguments
stringoverlayNameoverlay name
stringtextureFilenametexture file name

Notes
deprecated, use createImageOverlay




createImageOverlay

Description
Create overlay object

Definition
function createImageOverlay(string textureFilename)

Arguments
stringtextureFilenametexture file name

Notes
since v4.1.3




setOverlayColor

Description
Set overlay color

Definition
function setOverlayColor(integer overlayId, float red, float green, float blue, float alpha)

Arguments
integeroverlayIdoverlay id
floatredred value
floatgreengreen value
floatblueblue value
floatalphaalpha value




setOverlayUVs

Description
Set overlay uv coordinates

Definition
function setOverlayUVs(integer overlayId, float u0, float v0, float u1, float v1, float u2, float v2, float u3, float v3)

Arguments
integeroverlayIdoverlay id
floatv0v0 texture coodinate
floatu0u0 texture coodinate
floatv1v1 texture coodinate
floatu1u1 texture coodinate
floatv2v2 texture coodinate
floatu2u2 texture coodinate
floatv3v3 texture coodinate
floatu3u3 texture coodinate




renderOverlay

Description
Render overlay

Definition
function renderOverlay(integer overlayId, float x1, float y1, float width, float height)

Arguments
integeroverlayIdoverlay id
floatxx position [0,1]
floatyy position [0,1]
floatwidthwidth [0,1]
floatheightheight [0,1]




createVideoOverlay

Description
Create video overlay object

Definition
function createVideoOverlay(string videoFilename, bool loopVideo, float soundVolume)

Arguments
stringvideoFilenamevideo file name
boolloopVideoloop video
floatsoundVolumesound volume [0,1]

Notes
since v4.1.3




playVideoOverlay

Description
Play video overlay object

Definition
function playVideoOverlay(integer videoOverlayId)

Arguments
integervideoOverlayIdoverlay id

Notes
since v4.1.3




stopVideoOverlay

Description
Stop video overlay object

Definition
function stopVideoOverlay(integer videoOverlayId)

Arguments
integervideoOverlayIdoverlay id

Notes
since v4.1.3




updateVideoOverlay

Description
Update video overlay object

Definition
function updateVideoOverlay(integer videoOverlayId)

Arguments
integervideoOverlayIdoverlay id

Notes
since v4.1.3




getVideoOverlayDuration

Description
Get video overlay duration

Definition
function getVideoOverlayDuration(integer videoOverlayId)

Arguments
integervideoOverlayIdoverlay id

Return Values
floatvideoDurationvideo duration in milliseconds

Notes
since v4.1.3




2010.11.25: getVideoOverlayCurrentTime

Description
Get video overlay current time

Definition
function getVideoOverlayCurrentTime(integer videoOverlayId)

Arguments
integervideoOverlayIdoverlay id

Return Values
floatvideoCurrentTimevideo current time in milliseconds

Notes
since v4.1.5




isVideoOverlayPlaying

Description
Get is video overlay playing

Definition
function isVideoOverlayPlaying(integer videoOverlayId)

Arguments
integervideoOverlayIdoverlay id

Return Values
boolisVideoOverlayPlayingis video overlay playing

Notes
since v4.1.3




Sound Function Reference


createSample

Description
Create sample object

Definition
function createSample(string objectName)

Arguments
stringobjectNamesample object name

Return Values
integersampleIdid of the created sample




loadSample

Description
Load sample object

Definition
function loadSample(integer objectId, string sampleFilename, bool b3DSound)

Arguments
integerobjectIdid of sample object
stringsampleFilenameSample filename (.wav)
boolb3DSoundtrue=enables 3D Sound-Rendering, false=disables 3D Sound-Rendering




playSample

Description
Play sample object

Definition
function playSample(integer objectId, integer loops, float volume, float offset)

Arguments
integerobjectIdid of sample object
integerloopsnumber of loops [0,n] 0 = endless looping
floatvolumevolume [0,1]
floatoffsetoffset in milliseconds




stopSample

Description
Stop sample object

Definition
function stopSample(integer objectId)

Arguments
integerobjectIdid of sample object




setSamplePitch

Description
Set sample pitch

Definition
function setSamplePitch(integer objectId, float pitch)

Arguments
integerobjectIdid of sample object
floatpitchpitch value [0.5-2.0]




getSamplePitch

Description
Get sample pitch

Definition
function getSamplePitch(integer objectId)

Arguments
integerobjectIdid of sample object

Return Values
floatpitchpitch of sample object




setSampleVolume

Description
Set sample volume

Definition
function setSampleVolume(integer objectId, float volume)

Arguments
integerobjectIdid of sample object
floatvolumevolume value




getSampleVolume

Description
Get sample volume

Definition
function getSampleVolume(integer objectId)

Arguments
integerobjectIdid of sample object

Return Values
floatvolumevolume of sample object




getSampleDuration

Description
Get sample duration

Definition
function getSampleDuration(integer objectId)

Arguments
integerobjectIdid of sample object

Return Values
floatdurationduration in milliseconds




setSampleVelocity

Description
Set velocity of a sample object

Definition
function setSampleVelocity(int sampleId, float x, float y, float z)

Arguments
integertransformIdid of transform object
floatxvelocity value towards x
floatyvelocity value towards y
floatzvelocity value towards z




getSampleVelocity

Description
Get velocity of a sample object

Definition
function getSampleVelocity(integer transformId)

Arguments
integertransformIdid of transform object

Return Values
floatxx value of velocity towards x
floatyy value of velocity towards y
floatzz value of velocity towards z




enableSampleFX

Description
enable audio effects - Reverberation

Definition
function enableSampleFX(integer objectId, int reverbPresetType)

Arguments
integerobjectIdid of sample object
intreverbPresetTypereverberation preset id [1, 68]




disableSampleFX

Description
disable audio effects - Reverberation

Definition
function disableSampleFX(integer objectId)

Arguments
integerobjectIdid of sample object




enableSampleFilter

Description
enable audio filters

Definition
function enableSampleFilter(integer objectId, int filterType, float gain, float gainLF, float gainHF)

Arguments
integerobjectIdid of sample object
intreverbPresetTypefilter type id [0, 3]
floatgaingain [0, 1]
floatgainLFgain low frequency [0, 1]
floatgainHFgain high frequency [0, 1]




disableSampleFilter

Description
disable audio filter

Definition
function disableSampleFilter(integer objectId)

Arguments
integerobjectIdid of sample object




createStreamedSample

Description
Create streamed sample object

Definition
function createStreamedSample(string objectName)

Arguments
stringobjectNamestreamed sample object name

Return Values
integersampleIdid of the created sample




loadStreamedSample

Description
Load streamed sample object

Definition
function loadStreamedSample(integer objectId, string bgmusicFilename)

Arguments
integerobjectIdid of streamed sample object
stringbgmusicFilenamestreamed sample filename (.ogg)




playStreamedSample

Description
Play streamed sample music object

Definition
function playStreamedSample(integer objectId, integer repeat)

Arguments
integerobjectIdid of streamed sample object
integerrepeatamount of recurrences. 0 means endless loop.




pauseStreamedSample

Description
Pause streamed sample object

Definition
function pauseStreamedSample(integer objectId)

Arguments
integerobjectIdid of streamed sample object




resumeStreamedSample

Description
Resume streamed sample

Definition
function resumeStreamedSample(integer objectId

Arguments
integerobjectIdid of streamed sample object




stopStreamedSample

Description
Stop streamed sample object

Definition
function stopStreamedSample(integer objectId

Arguments
integerobjectIdid of streamed sample object




setStreamedSampleVolume

Description
Set streamed sample volume

Definition
function setStreamedSampleVolume(integer objectId, float volume)

Arguments
integer objectId id of sample object
float volume volume value




getStreamedSampleVolume

Description
Get streamed sample volume

Definition
function getStreamedSampleVolume(integer objectId)

Arguments
integer objectId id of sample object

Return Values
float volume volume of sample object




createAudioSource

Description
Create audio source object for 3D sounds

Definition
function createAudioSource(string audioSourceName, string sampleFilename, float radius, float innerRadius, float volume, integer loops)

Arguments
stringaudioSourceNameaudio source name
stringsampleFilenamesample file name (.wav or .ogg)
floatradiusradius
floatinnerRadiusinner radius
floatvolumevolume [0,1]
integerloopsloops




getAudioSourceSample

Description
Gets the sample id of an audio source

Definition
function getAudioSourceSample(integer objectId)

Arguments
idobjectIdid of the audio source

Return Values
integersampleIdid of the sample



Input Function Reference


2010.11.25: getNumOfGamepads

Description
Get number of joysticks/gampads

Definition
function getNumOfGamepads()

Return Values
integernumOfGamepadsnumber of joysticks/gampads

Notes
since v4.1.5




getInputAxis

Description
Get joystick/gampad axis value

Definition
function getInputAxis(integer axisNumber, /2010.11.25: integer gamepadIndex/)

Arguments
integeraxisNumberaxis number [0=Input.AXIS_1, 5=Input.AXIS_6],
integergamepadIndexjoystick/gampad index

Return Values
floataxisValueaxis value [-1, 1]




getInputButton

Description
Get joystick/gampad button value

Definition
function getInputButton(integer buttonNumber)

Arguments
integerbuttonNumberbutton number [0=Input.BUTTON_1, 15==Input.BUTTON_16]

Return Values
floatbuttonValuebutton value [0, 1]




keyEvent and mouseEvent callbacks




XML Function Reference

XML Path

XML paths used in the getXML... and setXML... functions have the following format:
node1.node2.....nodeN
or
node1.node2.....nodeN#attribute.

Example:
<test>
   <test1 attr="test">
      This is some text
   </test1>
</test>

To get the attribute "attr", use the path test.test1#attr.
To get the content of test1, use the path test.test1.

createXMLFile

Description
Create an empty XML file

Definition
function createXMLFile(string objectName, string filename, string rootNodeName)

Arguments
stringobjectNameinternal name for the object created
stringfilenamefilename (full path)
stringrootNodeNamename of the root node

Return Values
integerobjectIdobject id




loadXMLFile

Description
Load XML file

Definition
function loadXMLFile(string objectName, string filename)

Arguments
stringobjectNameinternal name for the object created
stringfilenamefilename (full path)

Return Values
integerobjectIdobject id




saveXMLFile

Description
Save XML file

Definition
function saveXMLFile(integer objectId)

Arguments
integerobjectIdobject id




getXMLInt

Description
Get XML file integer attribute
See XML Path

Definition
function getXMLInt(integer objectId, string attributePath)

Arguments
integerobjectIdobject id
stringattributePathattribute path

Return Values
integervalueattribute value




getXMLFloat

Description
Get XML file float attribute
See XML Path

Definition
function getXMLFloat(integer objectId, string attributePath)

Arguments
integerobjectIdobject id
stringattributePathattribute path

Return Values
floatvalueattribute value




getXMLBool

Description
Get XML file boolean attribute
See XML Path

Definition
function getXMLBool(integer objectId, string attributePath)

Arguments
integerobjectIdobject id
stringattributePathattribute path

Return Values
booleanvalueattribute value




getXMLString

Description
Get XML file string attribute
See XML Path

Definition
function getXMLString(integer objectId, string attributePath)

Arguments
integerobjectIdobject id
stringattributePathattribute path

Return Values
stringvalueattribute value




setXMLInt

Description
Set XML file integer attribute
See XML Path

Definition
function setXMLInt(integer objectId, string attributePath, integer value)

Arguments
integerobjectIdobject id
stringattributePathattribute path
integervalueattribute value




setXMLFloat

Description
Set XML file float attribute
See XML Path

Definition
function setXMLFloat(integer objectId, string attributePath, float value)

Arguments
integerobjectIdobject id
stringattributePathattribute path
floatvalueattribute value




setXMLBool

Description
Set XML file boolean attribute
See XML Path

Definition
function setXMLBool(integer objectId, string attributePath, boolean value)

Arguments
integerobjectIdobject id
stringattributePathattribute path
booleanvalueattribute value




setXMLString

Description
Set XML file string attribute
See XML Path

Definition
function setXMLString(integer objectId, string attributePath, boolean value)

Arguments
integerobjectIdobject id
stringattributePathattribute path
booleanvalueattribute value



2010.11.25: hasXMLProperty

Description
Returns if an XML path is available in the file
See XML Path

Definition
function hasXMLProperty(integer objectId, string propertyPath)

Arguments
integerobjectIdobject id
stringpropertyPathpath to a node or an attribute

Return Values
booleanvalueis the given property available in the xml file




Network Function Reference


netStartup

Description
Startup network subsystem

Definition
function netStartup(integer maxConnections, integer threadSleepTimer, string localHostAddress, integer port, string packetReceivedCallback, object targetObject)

Arguments
integermaxConnectionsmax connections
integerthreadSleepTimerthread sleep timer (milliseconds)
stringlocalHostAddresslocal listen host address. Leave empty to disable listen port.
integerportlisten port number
stringpacketReceivedCallbackcallback function which is called when a packet was received
objecttargetObjecttarget object (optional), the callback function is called as a member function of targetObject

Return Values
booleanresulttrue if successful false otherwise




netSetMaximumIncomingConnections

Description
Set maximum incoming connections

Definition
function netSetMaximumIncomingConnections(integer maximumIncomingConnections)

Arguments
integermaximumIncomingConnectionsmaximum incoming connections




netSetIncomingPassword

Description
Set incoming password

Definition
function netSetIncomingPassword(string incomingPassword)

Arguments
stringincomingPasswordincoming password




netConnect

Description
Connect

Definition
function netConnect(string host, integer port, string password)

Arguments
stringhostremote host address
integerportremote post address
stringpasswordconnection password

Return Values
integerstreamIdstream id (zero if failed)




netCloseConnection

Description
Close network connection

Definition
function netCloseConnection(integer streamId, boolean sendDisconnectionNotification, integer orderingChannel)

Arguments
booleansendDisconnectionNotificationsend disconnection notification
integerorderingChannelordering channel




netShutdown

Description
Network shutdown

Definition
function netShutdown(integer maxBlockDurationTime, integer orderingChannel)

Arguments
integerstreamIdstream id
integermaxBlockDurationTimemaximum blocking duration time
integerorderingChannelordering channel




netSendStream

Description
Network send stream

Definition
function netSendStream(integer streamId, string priority, string reliability, integer orderingChannel, boolean flushStream)

Arguments
integerstreamIdstream id
stringprioritypriority (low, medium or high)
stringreliabilityreliability (unreliable, unreliable_sequenced, reliable, reliable_sequenced or reliable_ordered)
integerorderingChannelordering channel
booleanflushStreamflush stream




streamWriteBool

Description
Stream write boolean

Definition
function streamWriteBool(integer streamId, boolean value)

Arguments
integerstreamIdstream id
booleanvaluevalue




streamWriteInt8

Description
Stream write 8bit sigend integer

Definition
function streamWriteInt8(integer value)

Arguments
integerstreamIdstream id
integervaluevalue [-127, 127]




streamWriteInt16

Description
Stream write 16bit signed integer

Definition
function streamWriteInt16(integer value)

Arguments
integerstreamIdstream id
integervaluevalue [-32768, 32768]




streamWriteInt32

Description
Stream write 32bit signed integer

Definition
function streamWriteInt32(integer value)

Arguments
integerstreamIdstream id
integervaluevalue




streamWriteIntN

Description
Stream write N bit signed integer. 0>N>32.

Definition
function streamWriteIntN(integer value)

Arguments
integerstreamIdstream id
integervaluevalue [-2^(N-1), 2^(N-1)]




streamWriteFloat32

Description
Stream write 32bit float

Definition
function streamWriteFloat32(float value)

Arguments
integerstreamIdstream id
floatvaluevalue




streamWriteString

Description
Stream write string

Definition
function streamWriteString(string value)

Arguments
integerstreamIdstream id
stringvaluevalue, max 64k characters




streamReadBool

Description
Stream read boolean

Definition
function streamReadBool(integer streamId)

Arguments
integerstreamIdstream id

Return Values
booleanvaluevalue




streamReadInt8

Description
Stream read 8bit signed integer

Definition
function streamReadInt8(integer streamId)

Arguments
integerstreamIdstream id

Return Values
integervaluevalue




streamReadInt16

Description
Stream read 16bit signed integer

Definition
function streamReadInt16(integer streamId)

Arguments
integerstreamIdstream id

Return Values
integervaluevalue




streamReadInt32

Description
Stream read 32bit signed integer

Definition
function streamReadInt32(integer streamId)

Arguments
integerstreamIdstream id

Return Values
integervaluevalue




streamReadIntN

Description
Stream read N bit signed integer

Definition
function streamReadIntN(integer streamId)

Arguments
integerstreamIdstream id

Return Values
integervaluevalue




streamReadFloat32

Description
Stream read 32bit float

Definition
function streamReadFloat32(integer streamId)

Arguments
integerstreamIdstream id

Return Values
floatvaluevalue




streamReadString

Description
Stream read string

Definition
function streamReadString(integer streamId)

Arguments
integerstreamIdstream id

Return Values
stringvaluevalue




streamGetNumOfUnreadBits

Description
Stream get number of unread bits

Definition
function streamGetNumOfUnreadBits(integer streamId)

Arguments
integerstreamIdstream id

Return Values
integervaluenumber of unread bit




streamGetReadOffset

Description
Stream get read offset

Definition
function streamGetReadOffset(integer streamId)

Arguments
integerstreamIdstream id

Return Values
integeroffsetRead offset




streamSetReadOffset

Description
Sets the read pointer to the given offset in bytes

Definition
function streamSetReadOffset(integer streamId, integer offset)

Arguments
integerstreamIdstream id
integeroffsetread offset in bytes




streamGetWriteOffset

Description
Returns the write pointer offset in bytes

Definition
function streamGetWriteOffset(integer streamId)

Arguments
integerstreamIdstream id

Return Values
integeroffsetWrite offset




streamSetWriteOffset

Description
Sets the write pointer to the given offset in bytes

Definition
function streamSetWriteOffset(integer streamId, integer offset)

Arguments
integerstreamIdstream id
integeroffsetwrite offset in bytes




Network defines

Description
Network message types

Definition
VariableDescription
Network.TYPE_APPLICATIONApplication
Network.TYPE_CONNECTION_REQUEST_ACCEPTEDConnection request accepted
Network.TYPE_CONNECTION_ATTEMPT_FAILEDConnection attempt failed
Network.TYPE_ALREADY_CONNECTEDAlready connected
Network.TYPE_NEW_INCOMING_CONNECTIONNew incoming connection
Network.TYPE_NO_FREE_INCOMING_CONNECTIONSNo free incoming connections
Network.TYPE_DISCONNECTION_NOTIFICATIONDisconnection notification
Network.TYPE_CONNECTION_LOSTConnection lost
Network.TYPE_RSA_PUBLIC_KEY_MISMATCHRSA public key mismatch
Network.TYPE_CONNECTION_BANNEDConnection banned
Network.TYPE_INVALID_PASSWORDInvalid password
Network.TYPE_MODIFIED_PACKETModified packet
Network.TYPE_PONGPong
Network.TYPE_ADVERTISE_SYSTEMAdvertise system
Network.TYPE_REMOTE_DISCONNECTION_NOTIFICATIONRemote disconnection notification
Network.TYPE_REMOTE_CONNECTION_LOSTRemote connection lost
Network.TYPE_REMOTE_NEW_INCOMING_CONNECTIONRemote new incoming connection




Callbacks Function Reference


Default callbacks

init

Description
This function is called once on startup. Create and load objects here.

Definition
function init()

Return Values
booleansuccessreturn true if successful




keyEvent

Description
This function is called when a key event occurs.

Definition
function keyEvent(float unicode, float sym, float modifier, boolean isDown)
Arguments
floatunicodeunicode value
floatsymsym key
floatmodifierkey modifier
booleanisDownis down state



mouseEvent

Description
This function is called when a mouse event occurs.

Definition
function mouseEvent(float posX, float posY, boolean isDown, boolean isUp, float button)
Arguments
floatposXx position [0,1]
floatposYy position [0,1]
booleanisDownis down state
booleanisUpis up state
floatbuttonbutton number



update

Description
This function is called once per frame to update game state.

Definition
function update(float dt)
Arguments
floatdttime between this frame and last frame in milliseconds



draw

Description
This function is called once per frame to draw game objects. Call render functions here.

Definition
function draw()

Custom callbacks

trigger callback

Description
This function is called when a trigger event occurs.

Definition
function triggerFunctionName(integer triggerId, string otherId, boolean onEnter, boolean onLeave, boolean onStay)
Arguments
integertriggerIdid of the trigger node
integerotherIdid of the other node
booleanonEnteron enter state
booleanonLeaveon leave state
booleanonStayon stay state



contact callback

Description
This function is called when a contact event occurs.

Definition
function onContact(integer objectId, integer otherObjectId, boolean isStart, float normalForce, float tangentialForce)
Arguments
integerobjectIdid of the object
integerotherObjectIdid of the other object
booleanisStartis start touch
floatnormalForcenormal contact force
floattangentialForcetangential contact force



raycast callback

Description
This function is called when a raycast hit event occurs.

Definition
function raycastFunctionName(integer hitObjectId, float x, float y, float z, float distance)
Arguments
integerhitObjectIdid of the hit node
floatxworld impact x
floatyworld impact y
floatzworld impact z
floatdistancedistance

Return Values
booleancontinuecontinue raycasting




create callback

Description
Create callbacks are called during i3d loads.

Definition
function createFunctionName(integer objectId)
Arguments
integerobjectIdid of the object




timer callback

Description
This function is called when a timer event occurs.

Definition
function timerFunctionName()
Return Values
booleankeepTimerreturn false if the timer should be removed




packet received callback

Description
This function is called when a network packet was received.

Definition
function packetReceived(packetType, timestamp, streamId)
Arguments
integerpacketTypetype of the packet. All available types are stored in the Network table
integertimestamptimestamp of when the packet was sent
integerstreamIdid of the stream containing the packet data




Foundation Reference

Scenegraph


translate

Description
Translate object (transform)

Definition
function translate(integer objectId, float dx, float dy, float dz)

Arguments
integerobjectIdobject id (transform)
floatdxx relative translation value
floatdyy relative translation value
floatdzz relative translation value

Source file
shared/foundation/scenegraph.lua




rotate

Description
Rotate object (transform)

Definition
function rotate(integer objectId, float dx, float dy, float dz)

Arguments
integerobjectIdobject id (transform)
floatdxx relative rotation value
floatdyy relative rotation value
floatdzz relative rotation value

Source file
shared/foundation/scenegraph.lua




toggleVisibility

Description
Toggle visibility of a scenegraph object

Definition
function toggleVisibility(integer objectId)

Arguments
integerobjectIdid of scenegraph object

Source file
shared/foundation/scenegraph.lua




printScenegraph

Description
Prints scenegraph object

Definition
function printScenegraph(integer objectId)

Arguments
integerobjectIdid of scenegraph object

Source file
shared/foundation/scenegraph.lua




Input




Key values

Description
Key values used by keyEvent function

Definition
VariableValueDescription
Input.KEY_a97Value of key a
Input.KEY_b98Value of key b
........
Input.KEY_z122Value of key z
Input.KEY_esc27Value of escape key

Source file
shared/foundation/input.lua




Mouse values

Description
Mouse values used by mouseEvent function

Definition
VariableValueDescription
Input.MOUSE_BUTTON_NONE0none mouse button
Input.MOUSE_BUTTON_LEFT1left mouse button
Input.MOUSE_BUTTON_MIDDLE2middle mouse button
Input.MOUSE_BUTTON_RIGHT3right mouse button

Source file
shared/foundation/input.lua




Gamepad/Joystick values

Description
Gamepad/Joystick axis values used by getInputAxis function

Definition
VariableValueDescription
Input.AXIS_X0x axis
Input.AXIS_Y1y axis
Input.AXIS_Z2z axis
Input.AXIS_W3w axis

Source file
shared/foundation/input.lua




Reverberation Preset values

Description
Reverberation preset values used by enableSampleFX function

Definition
VariableValueDescription
Audio.REVERB_PRESET_DEFAULT1Value of default reverberation preset
Audio.REVERB_PRESET_GENERIC2Value of generic reverberation preset
........
Audio.REVERB_PRESET_SPORT_FULLSTADIUM67Preset values of a full sport stadium
Audio.REVERB_PRESET_SPORT_STADIUMTANNOY68Preset values of a statium tannoy

Source file
shared/foundation/audio.lua




Filter types

Description
Filter types values used by enableSampleFilter function

Definition
VariableValueDescription
Audio.FILTER_NULL0Value of a NULL filter type. A filter that has no parameters and does nothing.
Audio.FILTER_LOWPASS1Value of a lowpass filter type. It is used to remove high frequency content from a signal. Not currently implemented
Audio.FILTER_HIGHPASS2Value of a hightpass filter type. It is used to remove low frequency content from a signal. Not currently implemented
Audio.FILTER_BANDPASS35Value of a bandpass filter type. It is used to remove high and low frequency content from a signal. Not currently implemented

Source file
shared/foundation/audio.lua




Latest Versions

18 June 2009

GIANTS SDK v4.1.3
GIANTS Editor v4.1.4
GIANTS Script Debugger v4.1.3
Maya Exporter Plugins v4.1.2
MAX Exporter Plugins v4.1.4
Blender Exporter Plugins v4.1.2

Latest Public Versions

30 March 2009

GIANTS Editor v4.1.2
Maya Exporter Plugins v4.1.2
3Ds MAX Exporter Plugins v4.1.2
Blender Exporter Plugins v4.1.2

» More

Login Login

User name


Password


 Register Now

Contact contact Newsletter

Subscribe to our newsletter and keep yourself informed about updates and new releases of the GIANTS engine. Register here.

GIANTS Logo