|
Printable Version |
Function and Foundation Reference
Table of Contents
Function Reference
General Function Reference
print Description
Print to console
Definition
function print(arg1, ...)
Arguments
any type arg1 variable to print any type ... variable to print
source
DescriptionSource script file
Definition
function source(filename)
Arguments
string filename name of script file
requestExit
DescriptionRequest application to exit at the end of this frame
Definition
function requestExit()
renderText
DescriptionRender text to viewport
/2010.11.25: See asciiToUtf8 to convert to utf8/
Definition
function renderText(float x, float y, float size, string str)
Arguments
float x x position [0, 1] float y y position [0, 1] float size font size string str string to print
setTextColor
DescriptionSet the text color to be used for the following renderText calls
Definition
function setTextColor(float r, float g, float b, float a)
Arguments
float r red color component [0, 1] float g green color component [0, 1] float b blue color component [0, 1] float a alpha (opacity) [0, 1]
setTextBold
DescriptionSet the text boldness to be used for the following renderText calls
Definition
function setTextBold(boolean isBold)
Arguments
boolean isBold bold state
setTextAlignment
DescriptionSet the text alignment to be used for the following renderText calls
Definition
function setTextAlignment(integer alignment)
Arguments
integer alignment alignment (RenderText.ALIGN_LEFT, RenderText.ALIGN_CENTER or RenderText.ALIGN_RIGHT)
setTextWrapWidth
DescriptionSet the text wrap width to be used for the following renderText calls
Definition
function setTextWrapWidth(float wrapWidth)
Arguments
float wrapWidth wrap width
Notes
since v4.1.4
unicodeToUtf8
DescriptionConverts an unicode value to an utf8 string
Definition
function unicodeToUtf8(integer unicode)
Arguments
Return Values
integer unicode unicode value
string utf8string utf8 formated string representing the unicode
Notes
since v4.1.4
utf8Strlen
DescriptionReturns the length of an utf8 formated string
Definition
function utf8Strlen(string utf8string)
Arguments
Return Values
string utf8string utf8 formated string
integer length length of the given string
Notes
since v4.1.4
utf8Substr
DescriptionReturns a sub string of an utf8 formated string
Definition
function utf8Substr(string utf8string, integer startIndex, integer length)
Arguments
Return Values
string utf8string utf8 formated string integer startIndex zero based start index integer length maximal length of the sub string (optional)
string subString utf8 formated sub string
Notes
since v4.1.4
setFog
DescriptionSet fog properties
Definition
function setFog(string fogType, float startDistanceOrDensity, float endDistance, float r, float g, float b)
Arguments
string fogType fog type ("none", "linear", "exp" or "exp2") float startDistanceOrDensity start distance (linear) or density (exp and exp2) float endDistance end distance (linear) float r color r float g color g float b color b
setVolumeFog
DescriptionSet volume fog properties
Definition
function setVolumeFog(string fogType, float startDistanceOrDensity, float endDistance, float yPlane, float r, float g, float b)
Arguments
string fogType fog type ("none", "linear", "exp" or "exp2") float startDistanceOrDensity start distance (linear) or density (exp and exp2) float endDistance end distance (linear) float yPlane y plane value float r color r float g color g float b color b
wrapMousePosition
DescriptionWrap mouse position
Definition
function wrapMousePosition(float x, float y)
Arguments
float x x coord [0, 1] float y y coord [0, 1]
setShowMouseCursor
DescriptionSet show mouse cursor
Definition
function setShowMouseCursor(boolean state)
Arguments
boolean state enable state
setCaption
DescriptionSet caption
Definition
function setCaption(string caption)
Arguments
string caption application caption
loadI3DFile
DescriptionLoad I3D file
Definition
function loadI3DFile(string filename)
Arguments
Return Values
string filename i3d filename
integer rootNodeId id of root node
project
DescriptionTransform vector from world space into screen space
Definition
function project(float wx, float wy, float wz)
Arguments
float wx world space x coordinate float wy world space y coordinate float wz world space z coordinate
Return Values
float sx screen space x coordinate float sy screen space y coordinate float sz screen space z coordinate
unProject
DescriptionTransform vector from screen space into world space
Definition
function unProject(float sx, float sy, float sz)
Arguments
float sx screen space x coordinate float sy screen space y coordinate float sz screen space z coordinate
Return Values
float wx world space x coordinate float wy world space y coordinate float wz world space z coordinate
addTimer
DescriptionAdds timer callback function
Definition
function addTimer(float time, string timerFunctionCallback, object instance)
Arguments
float time time in milliseconds string triggerFunctionCallback trigger function callback object instance instance object (optional)
Return Values
integer timerId timer id
setTimerTime
DescriptionSet timer interval time
Definition
function setTimerTime(integer timerId, float time)
Arguments
integer timerId timer id float time time in milliseconds
saveScreenshot
DescriptionSave screenshot
Definition
function saveScreenshot(string filename)
Arguments
string filename filename
getAppBasePath
DescriptionGet application base path
Definition
function getAppBasePath()
Return Values
string appBasePath application base path
getUserProfileAppPath
DescriptionGet user profile application path
Definition
function getUserProfileAppPath()
Return Values
string getUserProfileAppPath user profile application path
copyFile
DescriptionGet copy file
Definition
function copyFile(string sourceFile, string destinationFile, boolean overwrite)
Arguments
string sourceFile source filename string destinationFile destination filename boolean overwrite overwrite file if it already exists
getFiles
DescriptionGet all files of a directory
Definition
function getFiles(string path, string fileFunctionCallback, object instance)
Arguments
string path path string fileFunctionCallback file function callback object instance instance object (optional)
Return Values
integer numFiles number of files
Entity Function Reference
delete
DescriptionDelete Entity/Object
Definition
function delete(integer objectId)
Arguments
integer objectId object id
getClassName
DescriptionGet class name of object
Definition
function getClassName(integer objectId)
Arguments
integer objectId object id
Return Values
string className class name of object
addDeleteListener
DescriptionAdd a delete listener
Definition
function addDeleteListener(integer objectId, string deleteFunctionCallback, object targetObject)
Arguments
integer objectId object id string deleteFunctionCallback delete listener function callback, is called when the entity is deleted object targetObject target object (optional), the callback function is called as a member function of targetObject
Return Values
integer listenerId id to the created callback, must be given to removeDeleteListener
removeDeleteListener
DescriptionRemove 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
integer objectId object id integer listenerId id of the delete listener
Node Function Reference
getParent
DescriptionGet parent id
Definition
function getParent(integer objectId)
Arguments
integer objectId object id
Return Values
integer parentId parent id
link
DescriptionLink node to another node
Definition
function link(integer parentNodeId, integer childNodeId)
Arguments
integer parentNodeId id of parent node integer childNodeId id of child node
unlink
DescriptionUnlink node from parent
Definition
function unlink(integer objectId)
Arguments
integer objectId object id
getNumOfChildren
DescriptionGet number of children
Definition
function getNumOfChildren(integer objectId)
Arguments
integer objectId object id
Return Values
integer numOfChildren number of children
getChildAt
DescriptionGet child id at given index
Definition
function getChildAt(integer objectId, integer index)
Arguments
integer objectId object id integer index index of child
Return Values
integer childId id of child node
getChild
DescriptionGet child id
Definition
function getChild(integer objectId, string childName)
Arguments
integer objectId object id string childName child name
Return Values
integer childId id of child node
getName
DescriptionGet object name
Definition
function getName(integer objectId)
Arguments
integer objectId object id
Return Values
string objectName object name
setName
DescriptionSet object name
Definition
function setName(integer objectId, string objectName)
Arguments
integer objectId object id string objectName new object name
removeChildAt
DescriptionRemove child at given index
Definition
function removeChildAt(integer objectId, integer index)
Arguments
integer objectId object id integer index index of child
Scenegraph Function Reference
createTransformGroup
DescriptionCreate transform group
Definition
function createTransformGroup(string transformName)
Arguments
string transformName name of transform object
Return Values
integer transformId id of transform object
setTranslation
DescriptionSet translation of a transform object
Definition
function setTranslation(integer transformId, float x, float y, float z)
Arguments
integer transformId id of transform object float x x value of translation float y y value of translation float z z value of translation
getTranslation
DescriptionGet translation of a transform object
Definition
function getTranslation(integer transformId)
Arguments
integer transformId id of transform object
Return Values
float x x value of translation float y y value of translation float z z value of translation
getWorldTranslation
DescriptionGet world translation of a transform object
Definition
function getWorldTranslation(integer transformId)
Arguments
integer transformId id of transform object
Return Values
float x x value of world translation float y y value of world translation float z z value of world translation
setRotation
DescriptionSet euler rotation of a transform object. Order ZY'X''
Definition
function setRotation(integer transformId, float x, float y, float z)
Arguments
integer transformId id of transform object float x x value of rotation (radian units) float y y value of rotation (radian units) float z z value of rotation (radian units)
getRotation
DescriptionGet rotation of a transform object
Definition
function getRotation(integer transformId)
Arguments
integer transformId id of transform object
Return Values
float x x value of rotation (radian units) float y y value of rotation (radian units) float z z value of rotation (radian units)
getWorldRotation
DescriptionGet world rotation of a transform object
Definition
function getWorldRotation(integer transformId)
Arguments
integer transformId id of transform object
Return Values
float x x value of world rotation (radian units) float y y value of world rotation (radian units) float z z value of world rotation (radian units)
setDirection
DescriptionSet 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
integer transformId id of transform object float x x value of direction float y y value of direction float z z value of direction float upX x value of up vector float upY y value of up vector float upY z value of up vector
setScale
DescriptionSet scale of a transform object
Definition
function setScale(integer transformId, float x, float y, float z)
Arguments
integer transformId id of transform object float x x value of scale float y y value of scale float z z value of scale
getScale
DescriptionGet scale of a transform object
Definition
function getScale(integer transformId)
Arguments
integer transformId id of transform object
Return Values
float x x value of scale float y y value of scale float z z value of scale
setVisibility
DescriptionSet transform object visibility
Definition
function setVisibility(integer transformId, boolean visibility)
Arguments
integer transformId id of transform object boolean visibility visibility state
getVisibility
DescriptionGet transform object visibility
Definition
function getVisibility(integer transformId)
Arguments
integer transformId id of transform object
Return Values
boolean visibility visibility state
clone
DescriptionClone scenegraph object
Definition
function clone(integer objectId, boolean groupUnderParent)
Arguments
id objectId id of scenegraph object boolean groupUnderParent if true the clone will be linked to the the same parent as objectId, otherwise it is not linked to the scenegraph
Return Values
id cloneId id of clone object
setRootNode
DescriptionSet scenegraph root node
Definition
function setRootNode(integer rootNodeId, /2010.11.25: integer viewportIndex/)
Arguments
integer rootNodeId id of new root node integer viewportIndex the index of the viewport [0-7]
getRootNode
DescriptionGet scenegraph root node used by the given viewport
Definition
function getRootNode(/2010.11.25: integer viewportIndex/)
Arguments
integer viewportIndex the index of the viewport [0-7]
localToWorld
DescriptionLocal space to world space transformation
Definition
function localToWorld(integer transformId, float x, float y, float z)
Arguments
integer transformId id of transform object float x x value of local position float y y value of local position float z z value of local position
Return Values
float x x value of world position float y y value of world position float z z value of world position
localDirectionToWorld
DescriptionLocal space to world space transformation, only direction without translation
Definition
function localDirectionToWorld(integer transformId, float x, float y, float z)
Arguments
integer transformId id of transform object float x x value of local direction float y y value of local direction float z z value of local direction
Return Values
float x x value of world direction float y y value of world direction float z z value of world direction
worldToLocal
DescriptionWorld space to local space transformation
Definition
function worldToLocal(integer transformId, float x, float y, float z)
Arguments
integer transformId id of transform object float x x value of world position float y y value of world position float z z value of world position
Return Values
float x x value of local position float y y value of local position float z z value of local position
worldDirectionToLocal
DescriptionWorld space to local space transformation, only direction without translation
Definition
function worldDirectionToLocal(integer transformId, float x, float y, float z)
Arguments
integer transformId id of transform object float x x value of world direction float y y value of world direction float z z value of world direction
Return Values
float x x value of local direction float y y value of local direction float z z value of local direction
getAnimCharacterSet
DescriptionGet animation character set id
Definition
function getAnimCharacterSet(integer objectId)
Arguments
integer objectId object id
Return Values
integer animId animation character set id
setUserAttribute
DescriptionSet user attribute value
Definition
function setUserAttribute(integer objectId, string attributeName, string typeName, integer/float/boolean/string value)
Arguments
integer objectId object id string attributeName name of the user attribute string typeName name of the type ("Integer", "Float", "String", "Boolean") integer/float/boolean/string value value of the user attribute, must match typeName
getUserAttribute
DescriptionGet user attribute value
Definition
function getUserAttribute(integer objectId, string attributeName)
Arguments
integer objectId object id string attributeName name of the user attribute
Return Values
integer/float/boolean/string attributeValue value of the user attribute, return type is the type of the attribute. Returns nil if attributeName doest not exist
setObjectMask
DescriptionSet object mask
Definition
function setObjectMask(integer objectId, integer mask)
Arguments
integer objectId object id integer mask the object mask to set
getObjectMask
DescriptionGet object mask
Definition
function getObjectMask(integer objectId)
Arguments
integer objectId object id
Return Values
integer mask the object mask
getTerrainHeightAtWorldPos
Descriptionget the terrain height at the given position
Definition
function getTerrainHeightAtWorldPos(integer terrainId, float x, float y, float z)
Arguments
integer terrainId terrain id float x x value of the world position float y y value of the world position float z z value of the world position
Return Values
float heightValue height of the terrain at the given position
Lighting Function Reference
setAmbientColor
DescriptionSet global ambient color
Definition
function setAmbientColor(float r, float g, float b)
Arguments
float r red value of ambient color float g green value of ambient color float b blue value of ambient color
getLightDiffuseColor
DescriptionGet diffuse color of a light
Definition
function getLightDiffuseColor(integer lightId)
Arguments
integer lightId id of light
Return Values
float r red value of diffuse color float g green value of diffuse color float b blue value of diffuse color
setLightDiffuseColor
DescriptionSet diffuse color of a light
Definition
function setLightDiffuseColor(integer lightId, float r, float g, float b)
Arguments
integer lightId id of light float r red value of diffuse color float g green value of diffuse color float b blue value of diffuse color
getLightSpecularColor
DescriptionGet specular color of a light
Definition
function getLightSpecularColor(integer lightId)
Arguments
integer lightId id of light
Return Values
float r red value of specular color float g green value of specular color float b blue value of specular color
setLightSpecularColor
DescriptionSet specular color of a light
Definition
function setLightSpecularColor(integer lightId, float r, float g, float b)
Arguments
integer lightId id of light float r red value of specular color float g green value of specular color float b blue value of specular color
getLightRange
DescriptionGet range of a light
Definition
function getLightRange(integer lightId)
Arguments
integer lightId id of light
Return Values
float range light range
setLightRange
DescriptionSet range of a light
Definition
function setLightRange(integer lightId, float range)
Arguments
integer lightId id of light float range light range
Camera Function Reference
createCamera
DescriptionCreate camera
Definition
function createCamera(integer cameraId /2010.11.25: string cameraName/, float fovy, float nearClip, float farClip)
Arguments
string cameraName camera name float fovy field of view (degree) float nearClip near clip float farClip far clip
setCamera
DescriptionSet currently used camera by the given viewport
Definition
function setCamera(integer cameraId, /2010.11.25: integer viewportIndex/)
Arguments
integer cameraId new camera id integer viewportIndex the index of the viewport [0-7]
getCamera
DescriptionGet currently used camera by the given viewport
Definition
function getCamera(/2010.11.25: integer viewportIndex/)
Arguments
integer viewportIndex the index of the viewport [0-7]
Return Values
integer currentCameraId current camera id
2010.11.25: setViewport
DescriptionSet the dimensions of the given viewport
Definition
function setViewport(integer viewportIndex, float left, float top, float width, float height)
Arguments
integer viewportIndex the index of the viewport [0-7] float left the start position from the left side [0-1] float top the start position from the top side [0-1] float width the width of the viewport [0-1] float height the height of the viewport [0-1]
Notes
since v4.1.5
setFovy
DescriptionSet the field of view angle
Definition
function setFovy(integer cameraId, float fovy)
Arguments
integer cameraId camera id float fovy field of view angle (degree)
getFovy
DescriptionGet the field of view angle
Definition
function getFovy(integer cameraId)
Arguments
integer cameraId camera id
Return Values
float fovy field of view angle (degree)
setNearClip
DescriptionSet the near clip distance
Definition
function setNearClip(integer cameraId, float nearClip)
Arguments
integer cameraId camera id float nearClip near clip distance
getNearClip
DescriptionGet the near clip distance
Definition
function getNearClip(integer cameraId)
Arguments
integer cameraId camera id
Return Values
float nearClip near clip distance
setFarClip
DescriptionSet the far clip distance
Definition
function setFarClip(integer cameraId, float farClip)
Arguments
integer cameraId camera id float farClip far clip distance
getFarClip
DescriptionGet the far clip distance
Definition
function getFarClip(integer cameraId)
Arguments
integer cameraId camera id
Return Values
float farClip far clip distance
aimCamera
DescriptionAim camera (spring/damper)
Definition
function aimCamera(integer cameraId, float x, float y, float z, float distance, float dt, float springStrength)
Arguments
integer cameraId camera id float x target x coordinate float y target y coordinate float z target z coordinate float distance distance from target float dt delta time float springStrength spring strength
Shape Function Reference
setShaderParameter
DescriptionSet shader parameter
Definition
function setShaderParameter(integer shapeId, string parameterName, float x, float y, float z, float w, boolean shared)
Arguments
integer shapeId shape id id string parameterName the name of the parameter float x x value float y y value float z z value float w w value boolean shared if true, the value is applied to all shapes with the same material
Physics Function Reference
simulatePhysics
DescriptionEnable/disable physics simulation
Definition
function simulatePhysics(boolean state)
Arguments
boolean state enable simulation state
simulatePhysicsTimeScale
DescriptionTime scale of physics simulation
Definition
function simulatePhysicsTimeScale(float scale)
Arguments
float scale physics time scale
createCCT
DescriptionCreate 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
integer transformId id of transform object float radius radius float height height float stepOffset step offset float slopeLimit slope limit float skinWidth skin width integer collisionMask collision mask float mass character mass [kg]
Return Values
integer characterIndex character index number
moveCCT
DescriptionEnqueue character movement
Definition
function moveCCT(integer characterIndex, float x, float y, float z, float collisionMasks)
Arguments
integer characterIndex character index number float x x value float y y value float z z value float collisionMasks collision masks
removeCCT
DescriptionRemove character controller
Definition
function removeCCT(integer characterIndex)
Arguments
integer characterIndex character index number
getCCTCollisionFlags
DescriptionGet character controller collision flags
Definition
function Engine.getCCTCollisionFlags(integer characterIndex)
Arguments
integer characterIndex character index number
Return Values
boolean side side flag boolean up up flag boolean down down flag
raycastAll
DescriptionRaycast objects
Definition
function raycastAll(float x, float y, float z, float nx, float ny, float nz, string raycastFunctionCallback, float maxDistance)
Arguments
float x origin x float y origin y float z origin z float nx direction x float ny direction y float nz direction z string raycastFunctionCallback raycast function callback float maxDistance max distance
Return Values
integer numShapes number of shapes hit
raycastClosest
DescriptionRaycast closest object
Definition
function raycastClosest(float x, float y, float z, float nx, float ny, float nz, string raycastFunctionCallback, float maxDistance)
Arguments
float x origin x float y origin y float z origin z float nx direction x float ny direction y float nz direction z string raycastFunctionCallback raycast function callback float maxDistance max distance
Return Values
integer numShapes number of shapes hit
overlapSphere
DescriptionOverlap sphere objects
Definition
function overlapSphere(float x, float y, float z, float radius, string overlapFunctionCallback, object targetObject)
Arguments
float x center x float y center y float z center z float radius radius string overlapFunctionCallback overlap function callback object targetObject target object (optional), the callback function is called as a member function of targetObject
Return Values
integer numShapes number of shape overlaps
overlapBox
DescriptionOverlap 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
float x center x float y center y float z center z float rx rotation x float ry rotation y float rz rotation z float ex extent x float ey extent y float ez extent z string overlapFunctionCallback overlap function callback object targetObject target object (optional), the callback function is called as a member function of targetObject
Return Values
integer numShapes number of shape overlaps
addForce
DescriptionAdd force to object
Definition
function addForce(integer transformId, float forceX, float forceY, float forceZ, float positionX, float positionY, float positionZ, boolean isPositionLocal)
Arguments
integer transformId id of transform object float forceX force x float forceY force y float forceZ force z float positionX position x float positionY position y float positionZ position z boolean isPositionLocal is position local
addImpulse
DescriptionAdd impulse to object
Definition
function addImpulse(integer transformId, float impulseX, float impulseY, float impulseZ, float positionX, float positionY, float positionZ, boolean isPositionLocal)
Arguments
integer transformId id of transform object float impulseX impulse x float impulseY impulse y float impulseZ impulse z float positionX position x float positionY position y float positionZ position z boolean isPositionLocal is position local
setJointDrive
DescriptionSet 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
integer transformId id of transform object float angle orientation angle float valueX orientation axis x or angular velocity x float valueY orientation axis y or angular velocity y float valueZ orientation axis z or angular velocity z
createWheelShape
DescriptionCreate wheel shape
Definition
function createWheelShape(integer transformId, float positionX, float positionY, float positionZ, float radius, float suspensionTravel, float spring, float damper, float mass)
Arguments
integer transformId id of transform object float positionX position x float positionY position y float positionZ position z float radius radius float suspensionTravel suspension travel float spring spring float damper damper float mass mass
Return Values
integer wheelShapeIndex wheel shape index
setWheelShapeProps
DescriptionSet wheel shape properties
Definition
function setWheelShapeProps(integer transformId, integer wheelShapeIndex, float motorTorque, float brakeTorque, float steerAngle)
Arguments
integer transformId id of transform object integer wheelShapeIndex wheel shape index float motorTorque motor torque float brakeTorque brake torque float steerAngle steer angle
getWheelShapeAxleSpeed
DescriptionGet wheel shape axle speed
Definition
function getWheelShapeAxleSpeed(integer transformId, integer wheelShapeIndex)
Arguments
integer transformId id of transform object integer wheelShapeIndex wheelShapeIndex
Return Values
float axleSpeed axle speed
getWheelShapeContactPoint
DescriptionGet wheel shape contact point
Definition
function getWheelShapeContactPoint(integer transformId, integer wheelShapeIndex)
Arguments
integer transformId id of transform object integer wheelShapeIndex wheelShapeIndex
Return Values
float x x position float y y position float z z position
getWheelShapePosition
DescriptionGet wheel shape position
Definition
function getWheelShapePosition(integer transformId, integer wheelShapeIndex)
Arguments
integer transformId id of transform object integer wheelShapeIndex wheelShapeIndex
Return Values
float x x position float y y position float z z position
addTrigger
DescriptionAdds 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
integer transformId id of transform object string triggerFunctionCallback trigger function callback object targetObject target object (optional), the callback function is called as a member function of targetObject
removeTrigger
DescriptionRemoves trigger callback function
Definition
function removeTrigger(integer transformId)
Arguments
integer transformId id of transform object
addContactReport
DescriptionAdds contact report callback function
Definition
function addContactReport(integer transformId, float forceThreshold, string contactReportFunctionCallback, object targetObject)
Arguments
integer transformId id of transform object float forceThreshold force threshold string triggerFunctionCallback contact report function callback object targetObject target object (optional), the callback function is called as a member function of targetObject
removeContactReport
DescriptionRemoves contact report callback function
Definition
function removeContactReport(integer transformId)
Arguments
integer transformId id of transform object
getRigidBodyType
DescriptionGet rigid body type
Definition
function getRigidBodyType(integer transformId)
Arguments
integer transformId id of transform object
Return Values
string type rigid body type ("Static", "Dynamic", "Kinematic" or "NoRigidBody")
setRigidBodyType
DescriptionSet rigid body type
Definition
function setRigidBodyType(integer transformId, string type)
Arguments
integer transformId id of transform object string type rigid body type ("Static", "Dynamic", "Kinematic" or "NoRigidBody")
getCollisionMask
DescriptionGet collision mask
Definition
function getCollisionMask(integer transformId)
Arguments
integer transformId id of transform object
Return Values
integer mask collision mask
setCollisionMask
DescriptionSet collision mask
Definition
function setCollisionMask(integer transformId, integer mask)
Arguments
integer transformId id of transform object integer mask collision mask
getCenterOfMass
DescriptionGet center of mass
Definition
function getCenterOfMass(integer transformId)
Arguments
integer transformId id of transform object
Return Values
float x x position float y y position float z z position
setCenterOfMass
DescriptionSet center of mass
Definition
function setCenterOfMass(integer transformId, float x, float y, float z)
Arguments
integer transformId id of transform object float x x position float y y position float z z position
getMass
DescriptionSet mass
Definition
function getMass(integer transformId)
Arguments
integer transformId id of transform object
Return Values
float mass mass
setMass
DescriptionSet mass
Definition
function setMass(integer transformId, float mass)
Arguments
integer transformId id of transform object float mass mass
Spline Function Reference
getSplinePosition
DescriptionGet spline position
Definition
function getSplinePosition(integer shapeId, float time)
Arguments
integer shapeId id of curve shape object float time time [0,1]
Return Values
float x x coordinate float y y coordinate float z z coordinate
getSplineOrientation
DescriptionGet spline orientation
Definition
function getSplineOrientation(integer shapeId, float time, float upDirX, float upDirY, float upDirZ)
Arguments
integer shapeId id of curve shape object float time time [0,1] float upDirX up direction x coordinate float upDirY up direction y coordinate float upDirZ up direction z coordinate
Return Values
float rx x rotation float ry y rotation float rz z rotation
getSplineLength
DescriptionGet spline length
Definition
function getSplineLength(integer shapeId)
Arguments
integer shapeId id of curve shape object
Return Values
float length length of spline
getSplineNumOfCV
DescriptionGet number of spline control vertices
Definition
function getSplineNumOfCV(integer shapeId)
Arguments
integer shapeId id of curve shape object
Return Values
integer num number of spline control vertices
getSplineCV
DescriptionGet spline control vertex
Definition
function getSplineCV(integer shapeId, float time)
Arguments
integer shapeId id of curve shape object integer index control vertex index
Return Values
float x control vertex x coordinate float y control vertex y coordinate float z control vertex z coordinate
Animation Function Reference
getAnimCharacterSet
DescriptionReturns the character set driving the transform group
Definition
function getAnimCharacterSet(integer transformId)
Arguments
integer transformId id of transform group
Return Values
integer id id of character set object, 0 if no character set is assigned to the transform group
enableAnimTrack
DescriptionEnable animation track
Definition
function enableAnimTrack(integer characterSetId, integer track)
Arguments
integer characterSetId id of CharacterSet object integer track track number
disableAnimTrack
DescriptionDisable animation track
Definition
function disableAnimTrack(string characterSetId, integer track)
Arguments
string characterSetId name of CharacterSet object integer track track number
isAnimTrackEnabled
DescriptionIs animation track enabled
Definition
function isAnimTrackEnabled(integer characterSetId, integer track)
Arguments
integer characterSetId id of CharacterSet object integer track track number
Return Values
bool state enable state
setAnimTrackSpeedScale
DescriptionSet animation track speed scale
Definition
function setAnimTrackSpeedScale(integer characterSetId, integer track, float speedScale)
Arguments
integer characterSetId id of CharacterSet object integer track track number float speedScale speed scale
setAnimTrackLoopState
DescriptionSet animation track loop state
Definition
function setAnimTrackLoopState(integer characterSetId, integer track, bool loopState)
Arguments
integer characterSetId id of CharacterSet object integer track track number bool loopState loop scale
setAnimTrackTime
DescriptionSet animation track time
Definition
function setAnimTrackTime(integer characterSetId, integer track, float time, /2010.11.25: boolean immediateUpdate/)
Arguments
integer characterSetId id of CharacterSet object integer track track number float time time bool immediateUpdate (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
DescriptionGet animation track time
Definition
function getAnimTrackTime(integer characterSetId, integer track)
Arguments
integer characterSetId id of CharacterSet object integer track track number
Return Values
float time current time
getAnimClipDuration
DescriptionGet the duration of the clip at the given index
Definition
function getAnimClipDuration(integer characterSetId, integer index)
Arguments
integer characterSetId id of CharacterSet object integer index clip index
Return Values
float duration clip duration
setAnimTrackBlendWeight
DescriptionSet animation track blend weight
Definition
function setAnimTrackBlendWeight(integer characterSetId, integer track, float weight)
Arguments
integer characterSetId id of CharacterSet object integer track track number float weight blend weight
getAnimTrackBlendWeight
DescriptionGet animation track blend weight
Definition
function getAnimTrackBlendWeight(integer characterSetId, integer track)
Arguments
integer characterSetId id of CharacterSet object integer track track number
Return Values
float weight blend weight
getAnimClipIndex
DescriptionReturns the index of the clip with the given name
Definition
function getAnimClipIndex(integer characterSetId, string clipName)
Arguments
integer characterSetId id of CharacterSet object string clipName the name of the clip to find
Return Values
integer index index of the clip, -1 if clip was not found
assignAnimTrackClip
DescriptionAssign clip to animation track
Definition
function assignAnimTrackClip(integer characterSetId, integer track, float clipIndex)
Arguments
integer characterSetId id of CharacterSet object integer track track number float clipIndex clip index number
isAnimTrackClipAssigned
DescriptionIs clip assigned to animation track
Definition
function isAnimTrackClipAssigned(integer characterSetId, integer track)
Arguments
integer characterSetId id of CharacterSet object integer track track number
Return Values
bool state assigned state
getAnimTrackAssignedClip
DescriptionGet animation track assigned clip index number
Definition
function getAnimTrackAssignedClip(integer characterSetId, integer track)
Arguments
integer characterSetId id of CharacterSet object integer track track number
Return Values
float clipIndex clip index number
clearAnimTrackClip
DescriptionClear animation track clip assignment
Definition
function clearAnimTrackClip(integer characterSetId, integer track)
Arguments
integer characterSetId id of CharacterSet object integer track track number
getAnimNumOfClips
DescriptionGet number of clips
Definition
function getAnimNumOfClips(integer characterSetId)
Arguments
integer characterSetId id of CharacterSet object
Return Values
float clips number of clips
Overlays Function Reference
createOverlay
DescriptionCreate image overlay object
Definition
function createOverlay(string overlayName, string textureFilename)
Arguments
string overlayName overlay name string textureFilename texture file name
Notes
deprecated, use createImageOverlay
createImageOverlay
DescriptionCreate overlay object
Definition
function createImageOverlay(string textureFilename)
Arguments
string textureFilename texture file name
Notes
since v4.1.3
setOverlayColor
DescriptionSet overlay color
Definition
function setOverlayColor(integer overlayId, float red, float green, float blue, float alpha)
Arguments
integer overlayId overlay id float red red value float green green value float blue blue value float alpha alpha value
setOverlayUVs
DescriptionSet 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
integer overlayId overlay id float v0 v0 texture coodinate float u0 u0 texture coodinate float v1 v1 texture coodinate float u1 u1 texture coodinate float v2 v2 texture coodinate float u2 u2 texture coodinate float v3 v3 texture coodinate float u3 u3 texture coodinate
renderOverlay
DescriptionRender overlay
Definition
function renderOverlay(integer overlayId, float x1, float y1, float width, float height)
Arguments
integer overlayId overlay id float x x position [0,1] float y y position [0,1] float width width [0,1] float height height [0,1]
createVideoOverlay
DescriptionCreate video overlay object
Definition
function createVideoOverlay(string videoFilename, bool loopVideo, float soundVolume)
Arguments
string videoFilename video file name bool loopVideo loop video float soundVolume sound volume [0,1]
Notes
since v4.1.3
playVideoOverlay
DescriptionPlay video overlay object
Definition
function playVideoOverlay(integer videoOverlayId)
Arguments
integer videoOverlayId overlay id
Notes
since v4.1.3
stopVideoOverlay
DescriptionStop video overlay object
Definition
function stopVideoOverlay(integer videoOverlayId)
Arguments
integer videoOverlayId overlay id
Notes
since v4.1.3
updateVideoOverlay
DescriptionUpdate video overlay object
Definition
function updateVideoOverlay(integer videoOverlayId)
Arguments
integer videoOverlayId overlay id
Notes
since v4.1.3
getVideoOverlayDuration
DescriptionGet video overlay duration
Definition
function getVideoOverlayDuration(integer videoOverlayId)
Arguments
integer videoOverlayId overlay id
Return Values
float videoDuration video duration in milliseconds
Notes
since v4.1.3
2010.11.25: getVideoOverlayCurrentTime
DescriptionGet video overlay current time
Definition
function getVideoOverlayCurrentTime(integer videoOverlayId)
Arguments
integer videoOverlayId overlay id
Return Values
float videoCurrentTime video current time in milliseconds
Notes
since v4.1.5
isVideoOverlayPlaying
DescriptionGet is video overlay playing
Definition
function isVideoOverlayPlaying(integer videoOverlayId)
Arguments
integer videoOverlayId overlay id
Return Values
bool isVideoOverlayPlaying is video overlay playing
Notes
since v4.1.3
Sound Function Reference
createSample
DescriptionCreate sample object
Definition
function createSample(string objectName)
Arguments
string objectName sample object name
Return Values
integer sampleId id of the created sample
loadSample
DescriptionLoad sample object
Definition
function loadSample(integer objectId, string sampleFilename, bool b3DSound)
Arguments
integer objectId id of sample object string sampleFilename Sample filename (.wav) bool b3DSound true=enables 3D Sound-Rendering, false=disables 3D Sound-Rendering
playSample
DescriptionPlay sample object
Definition
function playSample(integer objectId, integer loops, float volume, float offset)
Arguments
integer objectId id of sample object integer loops number of loops [0,n] 0 = endless looping float volume volume [0,1] float offset offset in milliseconds
stopSample
DescriptionStop sample object
Definition
function stopSample(integer objectId)
Arguments
integer objectId id of sample object
setSamplePitch
DescriptionSet sample pitch
Definition
function setSamplePitch(integer objectId, float pitch)
Arguments
integer objectId id of sample object float pitch pitch value [0.5-2.0]
getSamplePitch
DescriptionGet sample pitch
Definition
function getSamplePitch(integer objectId)
Arguments
integer objectId id of sample object
Return Values
float pitch pitch of sample object
setSampleVolume
DescriptionSet sample volume
Definition
function setSampleVolume(integer objectId, float volume)
Arguments
integer objectId id of sample object float volume volume value
getSampleVolume
DescriptionGet sample volume
Definition
function getSampleVolume(integer objectId)
Arguments
integer objectId id of sample object
Return Values
float volume volume of sample object
getSampleDuration
DescriptionGet sample duration
Definition
function getSampleDuration(integer objectId)
Arguments
integer objectId id of sample object
Return Values
float duration duration in milliseconds
setSampleVelocity
DescriptionSet velocity of a sample object
Definition
function setSampleVelocity(int sampleId, float x, float y, float z)
Arguments
integer transformId id of transform object float x velocity value towards x float y velocity value towards y float z velocity value towards z
getSampleVelocity
DescriptionGet velocity of a sample object
Definition
function getSampleVelocity(integer transformId)
Arguments
integer transformId id of transform object
Return Values
float x x value of velocity towards x float y y value of velocity towards y float z z value of velocity towards z
enableSampleFX
Descriptionenable audio effects - Reverberation
Definition
function enableSampleFX(integer objectId, int reverbPresetType)
Arguments
integer objectId id of sample object int reverbPresetType reverberation preset id [1, 68]
disableSampleFX
Descriptiondisable audio effects - Reverberation
Definition
function disableSampleFX(integer objectId)
Arguments
integer objectId id of sample object
enableSampleFilter
Descriptionenable audio filters
Definition
function enableSampleFilter(integer objectId, int filterType, float gain, float gainLF, float gainHF)
Arguments
integer objectId id of sample object int reverbPresetType filter type id [0, 3] float gain gain [0, 1] float gainLF gain low frequency [0, 1] float gainHF gain high frequency [0, 1]
disableSampleFilter
Descriptiondisable audio filter
Definition
function disableSampleFilter(integer objectId)
Arguments
integer objectId id of sample object
createStreamedSample
DescriptionCreate streamed sample object
Definition
function createStreamedSample(string objectName)
Arguments
string objectName streamed sample object name
Return Values
integer sampleId id of the created sample
loadStreamedSample
DescriptionLoad streamed sample object
Definition
function loadStreamedSample(integer objectId, string bgmusicFilename)
Arguments
integer objectId id of streamed sample object string bgmusicFilename streamed sample filename (.ogg)
playStreamedSample
DescriptionPlay streamed sample music object
Definition
function playStreamedSample(integer objectId, integer repeat)
Arguments
integer objectId id of streamed sample object integer repeat amount of recurrences. 0 means endless loop.
pauseStreamedSample
DescriptionPause streamed sample object
Definition
function pauseStreamedSample(integer objectId)
Arguments
integer objectId id of streamed sample object
resumeStreamedSample
DescriptionResume streamed sample
Definition
function resumeStreamedSample(integer objectId
Arguments
integer objectId id of streamed sample object
stopStreamedSample
DescriptionStop streamed sample object
Definition
function stopStreamedSample(integer objectId
Arguments
integer objectId id of streamed sample object
setStreamedSampleVolume
DescriptionSet streamed sample volume
Definition
function setStreamedSampleVolume(integer objectId, float volume)
Arguments
integer objectId id of sample object float volume volume value
getStreamedSampleVolume
DescriptionGet streamed sample volume
Definition
function getStreamedSampleVolume(integer objectId)
Arguments
integer objectId id of sample object
Return Values
float volume volume of sample object
createAudioSource
DescriptionCreate audio source object for 3D sounds
Definition
function createAudioSource(string audioSourceName, string sampleFilename, float radius, float innerRadius, float volume, integer loops)
Arguments
string audioSourceName audio source name string sampleFilename sample file name (.wav or .ogg) float radius radius float innerRadius inner radius float volume volume [0,1] integer loops loops
getAudioSourceSample
DescriptionGets the sample id of an audio source
Definition
function getAudioSourceSample(integer objectId)
Arguments
id objectId id of the audio source
Return Values
integer sampleId id of the sample
Input Function Reference
2010.11.25: getNumOfGamepads
DescriptionGet number of joysticks/gampads
Definition
function getNumOfGamepads()
Return Values
integer numOfGamepads number of joysticks/gampads
Notes
since v4.1.5
getInputAxis
DescriptionGet joystick/gampad axis value
Definition
function getInputAxis(integer axisNumber, /2010.11.25: integer gamepadIndex/)
Arguments
integer axisNumber axis number [0=Input.AXIS_1, 5=Input.AXIS_6], integer gamepadIndex joystick/gampad index
Return Values
float axisValue axis value [-1, 1]
getInputButton
DescriptionGet joystick/gampad button value
Definition
function getInputButton(integer buttonNumber)
Arguments
integer buttonNumber button number [0=Input.BUTTON_1, 15==Input.BUTTON_16]
Return Values
float buttonValue button 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
DescriptionCreate an empty XML file
Definition
function createXMLFile(string objectName, string filename, string rootNodeName)
Arguments
string objectName internal name for the object created string filename filename (full path) string rootNodeName name of the root node
Return Values
integer objectId object id
loadXMLFile
DescriptionLoad XML file
Definition
function loadXMLFile(string objectName, string filename)
Arguments
string objectName internal name for the object created string filename filename (full path)
Return Values
integer objectId object id
saveXMLFile
DescriptionSave XML file
Definition
function saveXMLFile(integer objectId)
Arguments
integer objectId object id
getXMLInt
DescriptionGet XML file integer attribute
See XML Path
Definition
function getXMLInt(integer objectId, string attributePath)
Arguments
integer objectId object id string attributePath attribute path
Return Values
integer value attribute value
getXMLFloat
DescriptionGet XML file float attribute
See XML Path
Definition
function getXMLFloat(integer objectId, string attributePath)
Arguments
integer objectId object id string attributePath attribute path
Return Values
float value attribute value
getXMLBool
DescriptionGet XML file boolean attribute
See XML Path
Definition
function getXMLBool(integer objectId, string attributePath)
Arguments
integer objectId object id string attributePath attribute path
Return Values
boolean value attribute value
getXMLString
DescriptionGet XML file string attribute
See XML Path
Definition
function getXMLString(integer objectId, string attributePath)
Arguments
integer objectId object id string attributePath attribute path
Return Values
string value attribute value
setXMLInt
DescriptionSet XML file integer attribute
See XML Path
Definition
function setXMLInt(integer objectId, string attributePath, integer value)
Arguments
integer objectId object id string attributePath attribute path integer value attribute value
setXMLFloat
DescriptionSet XML file float attribute
See XML Path
Definition
function setXMLFloat(integer objectId, string attributePath, float value)
Arguments
integer objectId object id string attributePath attribute path float value attribute value
setXMLBool
DescriptionSet XML file boolean attribute
See XML Path
Definition
function setXMLBool(integer objectId, string attributePath, boolean value)
Arguments
integer objectId object id string attributePath attribute path boolean value attribute value
setXMLString
DescriptionSet XML file string attribute
See XML Path
Definition
function setXMLString(integer objectId, string attributePath, boolean value)
Arguments
integer objectId object id string attributePath attribute path boolean value attribute value
2010.11.25: hasXMLProperty
DescriptionReturns if an XML path is available in the file
See XML Path
Definition
function hasXMLProperty(integer objectId, string propertyPath)
Arguments
integer objectId object id string propertyPath path to a node or an attribute
Return Values
boolean value is the given property available in the xml file
Network Function Reference
netStartup
DescriptionStartup network subsystem
Definition
function netStartup(integer maxConnections, integer threadSleepTimer, string localHostAddress, integer port, string packetReceivedCallback, object targetObject)
Arguments
integer maxConnections max connections integer threadSleepTimer thread sleep timer (milliseconds) string localHostAddress local listen host address. Leave empty to disable listen port. integer port listen port number string packetReceivedCallback callback function which is called when a packet was received object targetObject target object (optional), the callback function is called as a member function of targetObject
Return Values
boolean result true if successful false otherwise
netSetMaximumIncomingConnections
DescriptionSet maximum incoming connections
Definition
function netSetMaximumIncomingConnections(integer maximumIncomingConnections)
Arguments
integer maximumIncomingConnections maximum incoming connections
netSetIncomingPassword
DescriptionSet incoming password
Definition
function netSetIncomingPassword(string incomingPassword)
Arguments
string incomingPassword incoming password
netConnect
DescriptionConnect
Definition
function netConnect(string host, integer port, string password)
Arguments
string host remote host address integer port remote post address string password connection password
Return Values
integer streamId stream id (zero if failed)
netCloseConnection
DescriptionClose network connection
Definition
function netCloseConnection(integer streamId, boolean sendDisconnectionNotification, integer orderingChannel)
Arguments
boolean sendDisconnectionNotification send disconnection notification integer orderingChannel ordering channel
netShutdown
DescriptionNetwork shutdown
Definition
function netShutdown(integer maxBlockDurationTime, integer orderingChannel)
Arguments
integer streamId stream id integer maxBlockDurationTime maximum blocking duration time integer orderingChannel ordering channel
netSendStream
DescriptionNetwork send stream
Definition
function netSendStream(integer streamId, string priority, string reliability, integer orderingChannel, boolean flushStream)
Arguments
integer streamId stream id string priority priority (low, medium or high) string reliability reliability (unreliable, unreliable_sequenced, reliable, reliable_sequenced or reliable_ordered) integer orderingChannel ordering channel boolean flushStream flush stream
streamWriteBool
DescriptionStream write boolean
Definition
function streamWriteBool(integer streamId, boolean value)
Arguments
integer streamId stream id boolean value value
streamWriteInt8
DescriptionStream write 8bit sigend integer
Definition
function streamWriteInt8(integer value)
Arguments
integer streamId stream id integer value value [-127, 127]
streamWriteInt16
DescriptionStream write 16bit signed integer
Definition
function streamWriteInt16(integer value)
Arguments
integer streamId stream id integer value value [-32768, 32768]
streamWriteInt32
DescriptionStream write 32bit signed integer
Definition
function streamWriteInt32(integer value)
Arguments
integer streamId stream id integer value value
streamWriteIntN
DescriptionStream write N bit signed integer. 0>N>32.
Definition
function streamWriteIntN(integer value)
Arguments
integer streamId stream id integer value value [-2^(N-1), 2^(N-1)]
streamWriteFloat32
DescriptionStream write 32bit float
Definition
function streamWriteFloat32(float value)
Arguments
integer streamId stream id float value value
streamWriteString
DescriptionStream write string
Definition
function streamWriteString(string value)
Arguments
integer streamId stream id string value value, max 64k characters
streamReadBool
DescriptionStream read boolean
Definition
function streamReadBool(integer streamId)
Arguments
integer streamId stream id
Return Values
boolean value value
streamReadInt8
DescriptionStream read 8bit signed integer
Definition
function streamReadInt8(integer streamId)
Arguments
integer streamId stream id
Return Values
integer value value
streamReadInt16
DescriptionStream read 16bit signed integer
Definition
function streamReadInt16(integer streamId)
Arguments
integer streamId stream id
Return Values
integer value value
streamReadInt32
DescriptionStream read 32bit signed integer
Definition
function streamReadInt32(integer streamId)
Arguments
integer streamId stream id
Return Values
integer value value
streamReadIntN
DescriptionStream read N bit signed integer
Definition
function streamReadIntN(integer streamId)
Arguments
integer streamId stream id
Return Values
integer value value
streamReadFloat32
DescriptionStream read 32bit float
Definition
function streamReadFloat32(integer streamId)
Arguments
integer streamId stream id
Return Values
float value value
streamReadString
DescriptionStream read string
Definition
function streamReadString(integer streamId)
Arguments
integer streamId stream id
Return Values
string value value
streamGetNumOfUnreadBits
DescriptionStream get number of unread bits
Definition
function streamGetNumOfUnreadBits(integer streamId)
Arguments
integer streamId stream id
Return Values
integer value number of unread bit
streamGetReadOffset
DescriptionStream get read offset
Definition
function streamGetReadOffset(integer streamId)
Arguments
integer streamId stream id
Return Values
integer offset Read offset
streamSetReadOffset
DescriptionSets the read pointer to the given offset in bytes
Definition
function streamSetReadOffset(integer streamId, integer offset)
Arguments
integer streamId stream id integer offset read offset in bytes
streamGetWriteOffset
DescriptionReturns the write pointer offset in bytes
Definition
function streamGetWriteOffset(integer streamId)
Arguments
integer streamId stream id
Return Values
integer offset Write offset
streamSetWriteOffset
DescriptionSets the write pointer to the given offset in bytes
Definition
function streamSetWriteOffset(integer streamId, integer offset)
Arguments
integer streamId stream id integer offset write offset in bytes
Network defines
DescriptionNetwork message types
Definition
Variable Description Network.TYPE_APPLICATION Application Network.TYPE_CONNECTION_REQUEST_ACCEPTED Connection request accepted Network.TYPE_CONNECTION_ATTEMPT_FAILED Connection attempt failed Network.TYPE_ALREADY_CONNECTED Already connected Network.TYPE_NEW_INCOMING_CONNECTION New incoming connection Network.TYPE_NO_FREE_INCOMING_CONNECTIONS No free incoming connections Network.TYPE_DISCONNECTION_NOTIFICATION Disconnection notification Network.TYPE_CONNECTION_LOST Connection lost Network.TYPE_RSA_PUBLIC_KEY_MISMATCH RSA public key mismatch Network.TYPE_CONNECTION_BANNED Connection banned Network.TYPE_INVALID_PASSWORD Invalid password Network.TYPE_MODIFIED_PACKET Modified packet Network.TYPE_PONG Pong Network.TYPE_ADVERTISE_SYSTEM Advertise system Network.TYPE_REMOTE_DISCONNECTION_NOTIFICATION Remote disconnection notification Network.TYPE_REMOTE_CONNECTION_LOST Remote connection lost Network.TYPE_REMOTE_NEW_INCOMING_CONNECTION Remote new incoming connection
Callbacks Function Reference
Default callbacks
init
DescriptionThis function is called once on startup. Create and load objects here.
Definition
function init()
Return Values
boolean success return true if successful
keyEvent
DescriptionThis function is called when a key event occurs.
Definition
function keyEvent(float unicode, float sym, float modifier, boolean isDown)Arguments
float unicode unicode value float sym sym key float modifier key modifier boolean isDown is down state
mouseEvent
DescriptionThis function is called when a mouse event occurs.
Definition
function mouseEvent(float posX, float posY, boolean isDown, boolean isUp, float button)Arguments
float posX x position [0,1] float posY y position [0,1] boolean isDown is down state boolean isUp is up state float button button number
update
DescriptionThis function is called once per frame to update game state.
Definition
function update(float dt)Arguments
float dt time between this frame and last frame in milliseconds
draw
DescriptionThis function is called once per frame to draw game objects. Call render functions here.
Definition
function draw()
Custom callbacks
trigger callback
DescriptionThis function is called when a trigger event occurs.
Definition
function triggerFunctionName(integer triggerId, string otherId, boolean onEnter, boolean onLeave, boolean onStay)Arguments
integer triggerId id of the trigger node integer otherId id of the other node boolean onEnter on enter state boolean onLeave on leave state boolean onStay on stay state
contact callback
DescriptionThis function is called when a contact event occurs.
Definition
function onContact(integer objectId, integer otherObjectId, boolean isStart, float normalForce, float tangentialForce)Arguments
integer objectId id of the object integer otherObjectId id of the other object boolean isStart is start touch float normalForce normal contact force float tangentialForce tangential contact force
raycast callback
DescriptionThis function is called when a raycast hit event occurs.
Definition
function raycastFunctionName(integer hitObjectId, float x, float y, float z, float distance)Arguments
integer hitObjectId id of the hit node float x world impact x float y world impact y float z world impact z float distance distance
Return Values
boolean continue continue raycasting
create callback
DescriptionCreate callbacks are called during i3d loads.
Definition
function createFunctionName(integer objectId)Arguments
integer objectId id of the object
timer callback
DescriptionThis function is called when a timer event occurs.
Definition
function timerFunctionName()Return Values
boolean keepTimer return false if the timer should be removed
packet received callback
DescriptionThis function is called when a network packet was received.
Definition
function packetReceived(packetType, timestamp, streamId)Arguments
integer packetType type of the packet. All available types are stored in the Network table integer timestamp timestamp of when the packet was sent integer streamId id of the stream containing the packet data
Foundation Reference
Scenegraph
translate
DescriptionTranslate object (transform)
Definition
function translate(integer objectId, float dx, float dy, float dz)
Arguments
integer objectId object id (transform) float dx x relative translation value float dy y relative translation value float dz z relative translation value
Source file
shared/foundation/scenegraph.lua
rotate
DescriptionRotate object (transform)
Definition
function rotate(integer objectId, float dx, float dy, float dz)
Arguments
integer objectId object id (transform) float dx x relative rotation value float dy y relative rotation value float dz z relative rotation value
Source file
shared/foundation/scenegraph.lua
toggleVisibility
DescriptionToggle visibility of a scenegraph object
Definition
function toggleVisibility(integer objectId)
Arguments
integer objectId id of scenegraph object
Source file
shared/foundation/scenegraph.lua
printScenegraph
DescriptionPrints scenegraph object
Definition
function printScenegraph(integer objectId)
Arguments
integer objectId id of scenegraph object
Source file
shared/foundation/scenegraph.lua
Input
Key values
DescriptionKey values used by keyEvent function
Definition
Variable Value Description Input.KEY_a 97 Value of key a Input.KEY_b 98 Value of key b ... ... .. Input.KEY_z 122 Value of key z Input.KEY_esc 27 Value of escape key
Source file
shared/foundation/input.lua
Mouse values
DescriptionMouse values used by mouseEvent function
Definition
Variable Value Description Input.MOUSE_BUTTON_NONE 0 none mouse button Input.MOUSE_BUTTON_LEFT 1 left mouse button Input.MOUSE_BUTTON_MIDDLE 2 middle mouse button Input.MOUSE_BUTTON_RIGHT 3 right mouse button
Source file
shared/foundation/input.lua
Gamepad/Joystick values
DescriptionGamepad/Joystick axis values used by getInputAxis function
Definition
Variable Value Description Input.AXIS_X 0 x axis Input.AXIS_Y 1 y axis Input.AXIS_Z 2 z axis Input.AXIS_W 3 w axis
Source file
shared/foundation/input.lua
Reverberation Preset values
DescriptionReverberation preset values used by enableSampleFX function
Definition
Variable Value Description Audio.REVERB_PRESET_DEFAULT 1 Value of default reverberation preset Audio.REVERB_PRESET_GENERIC 2 Value of generic reverberation preset ... ... .. Audio.REVERB_PRESET_SPORT_FULLSTADIUM 67 Preset values of a full sport stadium Audio.REVERB_PRESET_SPORT_STADIUMTANNOY 68 Preset values of a statium tannoy
Source file
shared/foundation/audio.lua
Filter types
DescriptionFilter types values used by enableSampleFilter function
Definition
Variable Value Description Audio.FILTER_NULL 0 Value of a NULL filter type. A filter that has no parameters and does nothing. Audio.FILTER_LOWPASS 1 Value of a lowpass filter type. It is used to remove high frequency content from a signal. Not currently implemented Audio.FILTER_HIGHPASS 2 Value of a hightpass filter type. It is used to remove low frequency content from a signal. Not currently implemented Audio.FILTER_BANDPASS 35 Value 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
Newsletter
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
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
Newsletter
Subscribe to our newsletter and keep yourself informed about updates and new releases of the GIANTS engine. Register here.
