Libraries.Game.Audio3D Documentation

Inherits from: Libraries.Interface.Item3D, Libraries.Interface.Item, Libraries.Language.Object, Libraries.Sound.Audio

Summary

Actions Summary Table

ActionsDescription
Add(Libraries.Interface.Item3D newItem)This action adds a different Item3D into this one.
Add(integer index, Libraries.Interface.Item3D newItem)This action adds a different Item3D into this one, storing the added Item3D at a specific index in the internal array.
AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)This action adds a new Behavior to this Item.
AddFocusListener(Libraries.Interface.Events.FocusListener listener)This action adds a FocusListener to the Item.
AddMouseListener(Libraries.Interface.Events.MouseListener listener)This action adds a MouseListener to the Item.
AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)This action adds a MouseMovementListener to the Item.
AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)This action adds a MouseWheelListener to the Item.
AddToQueue(Libraries.Sound.AudioSamples samples)The AddToQueue action adds AudioSamples to the end of the data stored in this Audio object.
AddTouchListener(Libraries.Interface.Events.TouchListener listener)This action adds a TouchListener to the Item.
ApplyAngularImpulse(Libraries.Compute.Vector3 impulse)
ApplyDamping(number seconds)
ApplyForce(Libraries.Compute.Vector3 force, Libraries.Compute.Vector3 point)
ApplyForceToCenter(Libraries.Compute.Vector3 force)
ApplyLinearImpulse(Libraries.Compute.Vector3 impulse, Libraries.Compute.Vector3 point)
ApplyTorque(Libraries.Compute.Vector3 torque)
BeginCollision(Libraries.Interface.Item item)This action is used to indicate that two items have just begun colliding.
CanRotate(boolean flag)
CancelBehaviors()This action stops all behaviors this Item is following without finishing them.
CollideWithChildren()
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
ComputeAngularImpulseDenominator(Libraries.Compute.Vector3 axis)
ComputeImpulseDenominator(Libraries.Compute.Vector3 position, Libraries.Compute.Vector3 normal)
CreateNodes(Libraries.Game.Collision.BroadphaseCollision3D broadphase, Libraries.Game.Collision.PhysicsPosition3D transform)transform:Translate(vector:GetX(), vector:GetY(), vector:GetZ() * -
DestroyNodes(Libraries.Game.Collision.BroadphaseCollision3D broadphase)transform:Translate(0, 0, -zAmoun
DisableDoppler()DisableDoppler will stop the audio from automatically calculating doppler shift.
DisableListenerDoppler()DisableListenerDoppler will make the audio engine stop using the velocity of the listener when calculating doppler effect.
DisableLooping()DisableLooping will ensure that an audio file stops playing when it reaches the end of the sound, instead of repeating.
Dispose()This action is used to free up any additional memory that is being used by this Item for purposes such as graphics.
DisposeAll()This action is used to call Dispose on this Item and on the entire children hierarchy of this Item.
DisposeChildren()This action is used to call Dispose on the entire children hierarchy of this Item.
Draw(Libraries.Game.Graphics.Painter3D painter)This action is used to draw this Item on the screen, and then draw all of the Item's children hierarchy on the screen.
Empty()This action will remove all Items from this Item's children hierarchy.
EmptyAll()This action will call Empty on the entire children hierarchy of this item, and then empty this item as well.
EmptyChildren()This action is used to call Empty on all children contained in this item's children hierarchy.
EnableDoppler()EnableDoppler will make the audio automatically calculate doppler shift for this audio.
EnableListenerDoppler()EnableListenerDoppler will make the audio engine consider the velocity of the listener when calculating doppler effects.
EnableLooping()EnableLooping will set the audio to continuously repeat itself when reaching the end of the audio instead of stopping.
EnablePhysics(boolean flag)
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
FastMoving(boolean flag)
FinishCollision(Libraries.Interface.Item item)This action is used to indicate that two items that were previously colliding no longer are.
Focus()This action sets focus on this Item.
GainedFocus(Libraries.Interface.Events.FocusEvent event)This action is fired if the item received the focus.
GetAccessibilityCode()This action returns the current accessiblity code for this Item
GetAccessibilityType()This action returns the name of the accessiblity code for this Item as Text
GetAngularDamping()
GetAngularFactor()
GetAngularVelocity()
GetBalance()GetBalance will return the current balance value of the sound.
GetBoundingBox(integer childIndex)Item3D child = undefin
GetCenterOfMassPosition()
GetCenterOfMassTransform()
GetCollisionGroupFlag()
GetCollisionGroupIndex()
GetCollisionList()
GetCollisionTransform()
GetCollisionTransform0()
GetCurrentAudioSamples()This action returns which AudioSample is currently queued when used on an Audio object that is streaming AudioSamples.
GetDefaultMaximumVolumeDistance()This action returns the default maximum volume distance for all newly created Audio objects.
GetDefaultRolloffRate()This action returns the default rolloff rate of newly loaded Audio objects.
GetDepth()GetDepth will return the depth of this Item3D.
GetDescription()This action returns the current internal description of the Item.
GetDimensions()GetDimensions will return a Vector3 object containing the width, height, and depth of this Item3D object.
GetFade()GetFade will return the current fade value of the sound.
GetFocusListeners()This action returns an Iterator containing all of the FocusListeners that have been added to this Item using the AddFocusListener action.
GetForce()
GetFriction()
GetGlobalPosition()This action will return the global position of the Item3D as a Vector3.
GetGlobalX()This action will return the global x coordinate of the Item3D.
GetGlobalY()This action will return the global y coordinate of the Item3D.
GetGlobalZ()This action will return the global z coordinate of the Item3D.
GetHashCode()This action gets the hash code for an object.
GetHeight()GetHeight will return the height of this Item3D.
GetInputGroup()This action returns the input group for this Item.
GetInputTable()
GetInterpolatedAngularVelocity()
GetInterpolatedLinearVelocity()
GetInterpolationTransform()
GetInterpolationWorldTransform()
GetInverseInertiaLocal()
GetInverseInertiaWorld()
GetInverseMass()
GetItem(integer index)This action returns an Item3D that was previously added to this Item3D by finding it at the given index in the internal array of children Items.
GetItemCount()This action returns the number of items contained in this Item3D.
GetItems()This action returns an iterator containing all the items contained in this Item3D.
GetJointList()
GetLayer()This action returns the current Layer3D that this Item3D is a part of in the Game libraries.
GetLights(Libraries.Containers.Array<Libraries.Game.Graphics.Light> array)This action will find all of the Light objects contained in the children hierarchy of this Item3D and add it to the end of the given array.
GetLights()This action will return an array of all Light objects contained in the children hierarchy of this Item3D.
GetLinearDamping()
GetLinearVelocity()
GetLinearVelocityAtLocalPoint(Libraries.Compute.Vector3 relativePosition)
GetListenerDirection()This action will get the direction that the listener is currently facing in.
GetListenerDirectionX()This action will get the x-component of the direction that the listener is currently facing in.
GetListenerDirectionY()This action will get the y-component of the direction that the listener is currently facing in.
GetListenerDirectionZ()This action will get the z-component of the direction that the listener is currently facing in.
GetListenerPosition()This action will return the current coordinates of the listener in virtual 3D space.
GetListenerUp()This action will get the direction that the listener currently considers "up".
GetListenerUpX()This action will get the x-component of the direction that the listener currently considers "up".
GetListenerUpY()This action will get the y-component of the direction that the listener currently considers "up".
GetListenerUpZ()This action will get the z-component of the direction that the listener currently considers "up".
GetListenerVelocity()This action will return the current velocity of the listener in virtual 3D space.
GetListenerVelocityX()This action will return the current x velocity of the listener in virtual 3D space.
GetListenerVelocityY()This action will return the current y velocity of the listener in virtual 3D space.
GetListenerVelocityZ()This action will return the current z velocity of the listener in virtual 3D space.
GetListenerX()This action will return the current x coordinate of the listener in virtual 3D space.
GetListenerY()This action will return the current x coordinate of the listener in virtual 3D space.
GetListenerZ()This action will return the current x coordinate of the listener in virtual 3D space.
GetMass()
GetMaximumVolumeDistance()The GetMaximumVolumeDistance action returns how far away the listener may be from the Audio and still hear the Audio at full volume.
GetMouseListeners()This action returns an Iterator containing all of the MouseListeners that have been added to this Item using the AddMouseListener action.
GetMouseMovementListeners()This action returns an Iterator containing all of the MouseMovementListeners that have been added to this Item using the AddMouseMovementListener action.
GetMouseWheelListeners()This action returns an Iterator containing all of the MouseWheelListeners that have been added to this Item using the AddMouseWheelListener action.
GetName()This action returns the current internal name of the Item.
GetNextFocus()This action returns the next focus item.
GetNode(integer index)
GetNodeCount()transform:Translate(xAmount, yAmount, -zAmoun
GetNodes()
GetOffsetX()This action returns the X offset of the Item.
GetOffsetY()This action returns the Y offset of the item.
GetOffsetZ()This action returns the Z offset of the item.
GetOrientation()
GetParent()This action returns the parent of this Item3D.
GetPhysicsProperties()
GetPitch()Returns the currently set pitch.
GetPosition()GetPosition will return a Vector3 object containing the X, Y, and Z coordinates of this Audio3D object.
GetPreviousFocus()This action returns the previous focus item.
GetPushVelocity()
GetResponsiveness()
GetRestitution()
GetRolloffRate()The GetRolloffRate action returns the rate at which 3D positional audio becomes quieter when positioned far away from the listener.
GetRotation()GetRotation gets the current degree of rotation of the sound.
GetSampleOffset()This action returns how many samples have been played from the Audio.
GetShape()vector3:Normalize
GetShapeType()Vector3 localOffset = child:GetGlobalPosition
GetSleepTime()
GetTimeOfImpact()Source: http://answers.
GetTorque()
GetTouchListeners()This action returns an Iterator containing all of the TouchListeners that have been added to this Item using the AddTouchListener action.
GetTransform()This action will return the Matrix4 containing the transformations applied to the Item3D, including its global position, rotation, and scaling.
GetTurnVelocity()
GetVelocity()GetVelocity returns a Vector3 object describing the velocity of this Audio object in 3D space.
GetVelocityX()GetVelocityX returns the velocity of this Audio object along the X axis in 3D space.
GetVelocityY()GetVelocityY returns the velocity of this Audio object along the Y axis in 3D space.
GetVelocityZ()GetVelocityZ returns the velocity of this Audio object along the Z axis in 3D space.
GetVolume()The GetVolume action returns the currently set volume.
GetWidth()GetWidth will return the width of this Item3D.
GetX()GetX will return the X coordinate of this Audio3D in 3D space.
GetY()GetY will return the Y coordinate of this Audio3D in 3D space.
GetZ()GetZ will return the Z coordinate of this Audio3D in 3D space.
HasMoved()
Hide()This action is used to indicate that an Item and all Items that were added to it should not be visible on the screen.
IntegrateVelocities(number seconds)
InternalApplyImpulse(Libraries.Compute.Vector3 linearComponent, Libraries.Compute.Vector3 angularComponent, number impulseMagnitude)
IsCollidable()
IsDopplerEnabled()IsDopplerEnabled will return whether or not the audio is currently set to use the doppler effect while playing.
IsEmpty()This action returns whether or not any items are contained in this Item.
IsFastMoving()
IsFocusable()This action returns whether or not the Item can currently receive focus.
IsFocused()The IsFocused action determines if this Item is currently focused, returning true if it is, or false if it is not.
IsListenerDopplerEnabled()This action will return whether or not the listener is currently using its velocity during doppler shift calculations.
IsLoaded()The IsLoaded action returns true if the Audio has been loaded with some data from either a file or from AudioSamples, and false if it hasn't been loaded yet.
IsLoopingEnabled()This action will return true or false based on whether or not the audio has been set to loop.
IsNonResponsive()
IsPhysicsEnabled()
IsPlaying()IsPlaying returns a boolean based on the sound's current state.
IsResponsive()
IsRotationAllowed()
IsShowing()This action returns whether the Item is currently set to be visible on the screen.
IsSimulated()
IsSimulationRequired()
IsStreaming()IsStreaming will return if an audio file was loaded as a streaming audio file.
IsUnmovable()
Load(text filePath)For convenience, Load can also be called using just a file name.
Load(Libraries.System.File file)The Load action will retrieve an audio file to be used by the Audio class.
Load(Libraries.Sound.AudioSamples samples)The Load action will take the given AudioSamples and load its data into this Audio object for use.
LoadToStream(Libraries.System.File file)The LoadToStream action will prepare an audio file to be streamed.
LoadToStream(Libraries.Sound.AudioSamples samples)The LoadToStream action will take the given AudioSamples and load it into the Audio.
LoadToStream(text filePath)The LoadToStream action can also be called using just a path to where a file is located for convenience.
LostFocus(Libraries.Interface.Events.FocusEvent event)This action is fired if the item lost the focus.
Move(Libraries.Compute.Vector3 vector)The Move action will increase the X, Y, and Z coordinates of this Audio3D by the values inside the given Vector3.
Move(number x, number y, number z)The Move action will increase the X, Y, and Z coordinates of this Audio3D by the given amounts.
MoveX(number x)MoveX will increase the X coordinate of this Audio3D by the given amount.
MoveY(number y)MoveY will increase the Y coordinate of this Audio3D by the given amount.
MoveZ(number z)MoveZ will increase the Z coordinate of this Audio3D by the given amount.
Pause()The Pause action will temporarily stop playing a sound, and remember where the sound was during its playback.
Play()Once we've prepared our audio file with either the Load or LoadToStream actions, we can play the file.
PlayUntilDone()If you want to make a program wait until your audio has stopped playing to continue, use the PlayUntilDone action.
PredictIntegratedTransform(number seconds, Libraries.Game.Collision.PhysicsPosition3D predictedTransform)
ProceedToTransform(Libraries.Game.Collision.PhysicsPosition3D transform)
ProcessMouseEvent(Libraries.Interface.Events.MouseEvent event)This action takes a MouseEvent and distributes it to any MouseListeners, MouseMovementListeners, and MouseWheelListeners that have been added to this Item3D.
ProcessTouchEvent(Libraries.Interface.Events.TouchEvent event)This action will take a TouchEvent and distribute it to any TouchListeners that have been added to this Item3D.
Remove(integer index)This action removes an Item that was previously added to this Item by finding it at the given index in the internal array of children Items.
Remove(Libraries.Interface.Item3D removed)This action removes an Item3D that was previously added to this Item3D.
RemoveFocusListener(Libraries.Interface.Events.FocusListener listener)This action removes a FocusListener from the Item.
RemoveFromQueue(Libraries.Sound.AudioSamples samples)The RemoveFromQueue action removes AudioSamples from the data stored in this Audio object.
RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)This action removes a MouseListener from the Item.
RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)This action removes a MouseMovementListener from the Item.
RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)This action removes a MouseWheelListener from the Item.
RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)This action removes a TouchListener from the Item.
RequireSimulation(boolean flag)
ResetMass()
Resume()The Resume action will resume playing an audio file that was paused.
Rotate(Libraries.Compute.Vector3 vector, number degrees, boolean rotateChildren)This action will rotate the Item3D about an axis represented by the given Vector3.
Rotate(number rotation)Rotate increases the degree of rotation of the sound, causing it to progress clockwise around the listener if given a positive value, or counter-clockwise around the listener if the action is given a negative value.
Rotate(Libraries.Compute.Vector3 vector, number degrees)This action will rotate the Item3D about an axis represented by the given Vector3.
Rotate(number rotateX, number rotateY, number rotateZ, number degrees)This action will rotate the Item3D about an axis.
Rotate(number rotateX, number rotateY, number rotateZ, number degrees, boolean rotateChildren)This action will rotate the Item3D about an axis represented by the first 3 given number values.
RotateAround(Libraries.Compute.Vector3 point, Libraries.Compute.Vector3 axis, number degrees)This action will rotate this Item3D clockwise about an axis passing through the given point.
RotateAround(Libraries.Compute.Vector3 point, Libraries.Compute.Vector3 axis, number degrees, boolean rotateChildren)This action will rotate this Item3D clockwise about an axis passing through the given point.
RotateChildren(number rotateX, number rotateY, number rotateZ, number degrees)This action will rotate all of the children of this Item3D clockwise about an axis passing through this item.
RotateChildren(Libraries.Compute.Vector3 vector, number degrees)This action will rotate all of the children of this Item3D clockwise about an axis passing through this item.
SaveKinematicState(number time)
Scale(Libraries.Compute.Vector3 vector)This action will scale the Item3D by the values of the given Vector3.
Scale(Libraries.Compute.Vector3 vector, boolean scaleChildren)This action will scale the Item3D by values of the given Vector3.
Scale(number scaleX, number scaleY, number scaleZ, boolean scaleChildren)This action will scale the Item3D by the given values.
Scale(number scaleX, number scaleY, number scaleZ)This action will scale the Item3D by the given values.
SetAccessibilityCode(integer newAccessibilityCode)This action changes the accessibility code for this Item.
SetAngularDamping(number angularDamping)
SetAngularVelocity(Libraries.Compute.Vector3 angularVelocity)
SetBalance(number position)SetBalance will change how the sound is played through stereo speakers or headphones.
SetCenterOfMassTransform(Libraries.Game.Collision.PhysicsPosition3D transform)
SetCollidable(boolean flag)
SetCollideWithChildren(boolean flag)
SetCollisionGroupFlag(boolean flag)
SetCollisionGroupIndex(integer index)
SetCollisionList(Libraries.Game.Collision.CollisionEdge3D list)
SetCollisionTransform(Libraries.Game.Collision.PhysicsPosition3D transform)
SetCollisionTransform0(Libraries.Game.Collision.PhysicsPosition3D transform)
SetDefaultMaximumVolumeDistance(number distance)This action sets the default maximum volume distance for all newly created Audio objects.
SetDefaultRolloffRate(number rolloff)This action sets the default rolloff rate of newly loaded Audio objects.
SetDepth(number setDepth)This action sets the depth the Item.
SetDescription(text newDescription)This action sets the internal description of the Item.
SetDimensions(number setWidth, number setHeight, number setDepth)This action sets the width, height, and depth of the Item3D.
SetDimensions(Libraries.Compute.Vector3 vector)This action sets the width, height, and depth of the Item3D.
SetFade(number fade)SetFade will change how the sound is played through speakers that have forward and back channels.
SetFocusable(boolean focus)The SetFocusable action sets whether or not this Item should be focusable.
SetForce(Libraries.Compute.Vector3 force)
SetFriction(number friction)
SetHasMoved(boolean flag)
SetHeight(number setHeight)This action sets the height of the Item.
SetInputGroup(text group)This action sets the input group for this Item.
SetInterpolatedAngularVelocity(Libraries.Compute.Vector3 velocity)
SetInterpolatedLinearVelocity(Libraries.Compute.Vector3 velocity)
SetInterpolationTransform(Libraries.Game.Collision.PhysicsPosition3D transform)
SetItem(integer index, Libraries.Interface.Item3D newItem)This action sets a value inside the internal item array of this Item3D.
SetJointList(Libraries.Game.Physics.Joints.JointEdge3D list)
SetLayer(Libraries.Game.Layer3D parentLayer)This action is used by the Game libraries to create a reference to the layer that this Item3D exists on.
SetLinearDamping(number linearDamping)
SetLinearVelocity(Libraries.Compute.Vector3 linearVelocity)
SetLinearVelocityX(number linearVelocityX)
SetLinearVelocityY(number linearVelocityY)
SetLinearVelocityZ(number linearVelocityZ)
SetListenerDirection(number x, number y, number z)SetListenerDirection sets the direction the listener is facing in virtual 3D space.
SetListenerDirection(Libraries.Compute.Vector3 direction)SetListenerDirection sets the direction the listener is facing in virtual 3D space.
SetListenerPosition(number x, number y, number z)SetListenerPosition sets the X, Y, and Z coordinates of the listener in 3D space.
SetListenerPosition(Libraries.Compute.Vector3 vector)SetListenerPosition sets the X, Y, and Z coordinates of the listener in 3D space.
SetListenerUp(number x, number y, number z)SetListenerUp sets the direction which is considered to be directly "up" from the listener.
SetListenerUp(Libraries.Compute.Vector3 up)SetListenerUp sets the direction which is considered to be directly "up" from the listener.
SetListenerVelocity(Libraries.Compute.Vector3 vector)SetListenerVelocity will set the listener's velocity in 3D space.
SetListenerVelocity(number x, number y, number z)SetListenerVelocity will set the listener's velocity in 3D space.
SetListenerVelocityX(number x)SetListenerVelocityX will set the listener's velocity along the x-axis.
SetListenerVelocityY(number x)SetListenerVelocityY will set the listener's velocity along the y-axis.
SetListenerVelocityZ(number z)SetListenerVelocityZ will set the listener's velocity along the z-axis.
SetListenerX(number x)SetListenerX sets the x-coordinate of the listener in 3D space.
SetListenerY(number y)SetListenerY sets the y-coordinate of the listener in 3D space.
SetListenerZ(number z)SetListenerZ sets the z-coordinate of the listener in 3D space.
SetMass(number mass)
SetMaximumVolumeDistance(number distance)The SetMaximumVolumeDistance action will determine how far the sound can be from the listener before the volume is adjusted due to distance attenuation.
SetName(text newName)This action sets the internal name of the Item.
SetNextFocus(Libraries.Interface.Item next)This action sets the next focus item.
SetNonResponsive()
SetOffset(Libraries.Compute.Vector3 vector)This action sets the offsets of the item.
SetOffset(number offsetX, number offsetY, number offsetZ)This action sets the offsets of the Item.
SetOffsetX(number offsetX)This action sets the X offset of the Item.
SetOffsetY(number offsetY)This action sets the Y offset of the Item.
SetOffsetZ(number offsetZ)This action sets the Z offset of the Item.
SetParent(Libraries.Interface.Item3D newItem)This action sets a reference to the parent item.
SetPhysicsProperties(Libraries.Game.Physics.PhysicsProperties3D properties)
SetPitch(number pitch)The SetPitch action sets the pitch of the sound.
SetPosition(Libraries.Compute.Vector3 vector)SetPosition will set the X, Y, and Z coordinates of the Audio3D in 3D space.
SetPosition(number x, number y, number z)SetPosition will set the X, Y, and Z coordinates of the Audio3D in 3D space.
SetPreviousFocus(Libraries.Interface.Item previous)This action sets the previous focus item.
SetResponsive()
SetResponsiveness(integer type)
SetRestitution(number restitution)
SetRolloffRate(number rolloff)The SetRolloffRate action sets the rate at which 3D positional audio becomes quieter when positioned far away from the listener.
SetRotation(number rotation)SetRotation sets a sound to play at a point in 3D space such that it has constant volume and is located a given number of degrees from the listener, where 0 degrees is directly in front of the listener and the sound rotates clockwise around the listener.
SetScreenPositionFromPhysicsPosition()
SetShape(Libraries.Game.Collision.Shapes.CollisionShape3D shape)We store the offsets we'll be using before manipulating anything.
SetSleepTime(number time)
SetTimeOfImpact(number timeOfImpact)
SetTorque(Libraries.Compute.Vector3 torque)
SetUnmovable()
SetVelocity(number x, number y, number z)SetVelocity will set the velocity of the audio in 3D space along the X, Y, and Z axes.
SetVelocity(Libraries.Compute.Vector3 velocity)SetVelocity will set the velocity of the audio in 3D space along the X, Y, and Z axes.
SetVelocityX(number x)SetVelocityX will set the velocity of the audio along the x-axis in 3D space.
SetVelocityY(number y)SetVelocityY will set the velocity of the audio along the y-axis in 3D space.
SetVelocityZ(number z)SetVelocityZ will set the velocity of the audio along the z-axis in 3D space.
SetVolume(number volume)The SetVolume action adjusts the volume of a sound.
SetWidth(number setWidth)This action sets the width of the Item.
SetX(number x)SetX will set the X coordinate of the Audio3D in 3D space.
SetY(number y)SetY will set the Y coordinate of the Audio3D in 3D space.
SetZ(number z)SetZ will set the Z coordinate of the Audio3D in 3D space.
ShouldCollide(Libraries.Interface.Item3D otherItem)
Show()This action is used to indicate that an Item and all Items that were added to it should be visible on the screen.
Simulate(boolean flag)
Stop()The Stop action will stop audio if it is currently playing.
Stream()The Stream action is used to load and play the next chunk of data for a file that was prepared using LoadToStream.
SynchronizeNodes()transform:Scale(vecto
Update(number seconds)This action will update the Audio3D, ensuring that its velocity is calculated for use in Doppler shift simulation (if it is enabled).
UpdateAll(number secondsSinceUpdate)This action calls the Update action on this Item and all Items that have been added to this item with the Add action.
UpdateInertia()

Actions Documentation

Add(Libraries.Interface.Item3D newItem)

This action adds a different Item3D into this one. This makes a few things happen. 1. The added item will get this item as its parent. 2. The added item's x, y, and z coordinates will become relative to this Item. 3. Most actions on this Item will also affect the added Item.

Example Code

use Libraries.Interface.Item3D

        Item3D parentItem
        Item3D child
        parentItem:Add(child)

Parameters

Add(integer index, Libraries.Interface.Item3D newItem)

This action adds a different Item3D into this one, storing the added Item3D at a specific index in the internal array.

Example Code

use Libraries.Interface.Item3D

        Item3D parentItem
        Item3D child
        parentItem:Add(0, child)

Parameters

AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)

This action adds a new Behavior to this Item.

Parameters

AddFocusListener(Libraries.Interface.Events.FocusListener listener)

This action adds a FocusListener to the Item. When the Item receives a FocusEvent due to either gaining or losing the focus, the listener will be notified.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.FocusListener
        Item myItem
        FocusListener listener
        myItem:AddFocusListener(listener)

Parameters

AddMouseListener(Libraries.Interface.Events.MouseListener listener)

This action adds a MouseListener to the Item. If the Item ever receives a MouseEvent due to a mouse click, the mouse listener will be notified.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseListener
        Item myItem
        MouseListener listener
        myItem:AddMouseListener(listener)

Parameters

AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)

This action adds a MouseMovementListener to the Item. If the Item ever receives a MouseEvent due to mouse movement, the listener will be notified.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseMovementListener
        Item myItem
        MouseMovementListener listener
        myItem:AddMouseMovementListener(listener)

Parameters

AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)

This action adds a MouseWheelListener to the Item. If the Item ever receives a MouseEvent due to the mouse wheel being scrolled, the listener will be notified.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseWheelListener
        Item myItem
        MouseWheelListener listener
        myItem:AddMouseWheelListener(listener)

Parameters

AddToQueue(Libraries.Sound.AudioSamples samples)

The AddToQueue action adds AudioSamples to the end of the data stored in this Audio object. To use this, the Audio must have been initialized using LoadToStream using an AudioSamples object, or must not have been initialized yet. This action can't be combined with actions that load a file into the Audio.

Example Code

use Libraries.Sound.AudioSamples
    use Libraries.Sound.Audio

    Audio audio

    AudioSamples samples1
    AudioSamples samples2
    AudioSamples samples3

    samples1:Load("Sonata-Part1.ogg")
    samples2:Load("Sonata-Part2.ogg")
    samples3:Load("Sonata-Part3.ogg")

    audio:LoadToStream(samples1)
    audio:AddToQueue(samples2)
    audio:AddToQueue(samples3)

    audio:Play()
    repeat while audio:IsPlaying()
        audio:Stream()
    end

Parameters

AddTouchListener(Libraries.Interface.Events.TouchListener listener)

This action adds a TouchListener to the Item. If the Item ever receives a TouchEvent, the listener will be notified.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.TouchListener
        Item myItem
        TouchListener listener
        myItem:AddTouchListener(listener)

Parameters

ApplyAngularImpulse(Libraries.Compute.Vector3 impulse)

Parameters

ApplyDamping(number seconds)

Parameters

ApplyForce(Libraries.Compute.Vector3 force, Libraries.Compute.Vector3 point)

Parameters

ApplyForceToCenter(Libraries.Compute.Vector3 force)

Parameters

ApplyLinearImpulse(Libraries.Compute.Vector3 impulse, Libraries.Compute.Vector3 point)

Parameters

ApplyTorque(Libraries.Compute.Vector3 torque)

Parameters

BeginCollision(Libraries.Interface.Item item)

This action is used to indicate that two items have just begun colliding. When two Items collide, the BeginCollision action should be called on both of them, with the other item passed as a parameter to the action. Note that this action does nothing by default, but classes that inherit from Item may override it.

Example Code

use Libraries.Interface.Item

        Item collider1
        Item collider2
        collider1:BeginCollision(collider2)
        collider2:BeginCollision(collider1)

Parameters

CanRotate(boolean flag)

Parameters

CancelBehaviors()

This action stops all behaviors this Item is following without finishing them.

CollideWithChildren()

Return

boolean

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

ComputeAngularImpulseDenominator(Libraries.Compute.Vector3 axis)

Parameters

Return

number

ComputeImpulseDenominator(Libraries.Compute.Vector3 position, Libraries.Compute.Vector3 normal)

Parameters

Return

number

CreateNodes(Libraries.Game.Collision.BroadphaseCollision3D broadphase, Libraries.Game.Collision.PhysicsPosition3D transform)

transform:Translate(vector:GetX(), vector:GetY(), vector:GetZ() * -

Parameters

DestroyNodes(Libraries.Game.Collision.BroadphaseCollision3D broadphase)

transform:Translate(0, 0, -zAmoun

Parameters

DisableDoppler()

DisableDoppler will stop the audio from automatically calculating doppler shift.

Example Code

use Libraries.Sound.Audio

        Audio audio
        audio:Load("Sound.wav")

        // The doppler effect is only noticable if the audio has velocity.
        audio:SetVelocity(4, 0, -2)

        // Because we disable the doppler effect here, the velocity we just set will
        // have no effect.
        audio:DisableDoppler()

DisableListenerDoppler()

DisableListenerDoppler will make the audio engine stop using the velocity of the listener when calculating doppler effect. This will NOT stop the engine from using the velocity of other audio objects that do have doppler enabled when calculating the doppler shift. The listener is universal to all audio objects, so disabling doppler effect on the listener will be in effect during calculation of doppler shift for ALL audio objects.

Example Code

use Libraries.Sound.Audio

        Audio audio
        audio:Load("Whale.wav")

        // In order to hear the doppler effect in action, the listener needs
        // to have velocity.
        audio:SetListenerVelocity(5, 0, 4)

        // Because we are now disabling the doppler effect on the listener, the
        // velocity we gave it will have no effect.
        audio:DisableListenerDoppler()

DisableLooping()

DisableLooping will ensure that an audio file stops playing when it reaches the end of the sound, instead of repeating. This is the default behavior, so it is only necessary to call this if there was a call to EnableLooping earlier in the program.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We need to load our audio before we change whether or not it will loop.
    audio:Load("test.wav")
    
    // We now enable looping. This will make the sound repeat forever until we
    // stop it or call "audio:DisableLooping()".
    audio:EnableLooping()

    // Our audio is currently set to loop. We can disable it again using DisableLooping().
    audio:DisableLooping()

Dispose()

This action is used to free up any additional memory that is being used by this Item for purposes such as graphics. Note that the Item class doesn't have any extra memory that needs to be released with this action, but some classes which inherit from Item, such as Libraries.Game.Graphics.Drawable, do.

DisposeAll()

This action is used to call Dispose on this Item and on the entire children hierarchy of this Item.

DisposeChildren()

This action is used to call Dispose on the entire children hierarchy of this Item. This will not call Dispose on this Item.

Draw(Libraries.Game.Graphics.Painter3D painter)

This action is used to draw this Item on the screen, and then draw all of the Item's children hierarchy on the screen. Note that Items themselves can not be drawn, but some classes that extend the Item class, such as the Libraries.Game.Graphics.Model class, can be. To see how they draw, see their documentation.

Parameters

Empty()

This action will remove all Items from this Item's children hierarchy. Note that this will not empty the hierarchies of the contained Items.

Example Code

use Libraries.Interface.Item3D

        Item3D parentItem
        Item3D child1
        Item3D child2
        Item3D grandchild
        parentItem:Add(child1)
        parentItem:Add(child2)
        child1:Add(grandChild)
        parentItem:Empty()

EmptyAll()

This action will call Empty on the entire children hierarchy of this item, and then empty this item as well.

EmptyChildren()

This action is used to call Empty on all children contained in this item's children hierarchy. This will not empty the children of this item.

EnableDoppler()

EnableDoppler will make the audio automatically calculate doppler shift for this audio. Doppler is enabled by default for audio, but will have no effect until the user provides the velocity of the audio via an action, such as SetVelocity(Vector3).

Example Code

use Libraries.Sound.Audio

        Audio audio
        audio:Load("Sound.wav")

        // We need to set the velocity of the audio in order to hear the doppler effect.
        audio:SetVelocity(4, 0, -2)

        // Doppler is already enabled by default, so this call would only be needed
        // if we had previously disabled the doppler effect on this audio.
        audio:EnableDoppler()

EnableListenerDoppler()

EnableListenerDoppler will make the audio engine consider the velocity of the listener when calculating doppler effects. The listener is universal to all audio objects, which means that if you enable doppler calculations for the listener, it will enable it when calculating doppler for ALL audio objects. By default, the listener already has doppler enabled, but this will have no effect until the listener is given a velocity.

Example Code

use Libraries.Sound.Audio

        Audio audio
        audio:Load("Whale.wav")

        // In order to hear the doppler effect in action, the listener needs
        // to have velocity.
        audio:SetListenerVelocity(5, 0, 4)

        // We now enable the doppler effect for the listener -- by default, this
        // is already on, so this is only needed if we'd previously disabled it.
        audio:EnableListenerDoppler()

EnableLooping()

EnableLooping will set the audio to continuously repeat itself when reaching the end of the audio instead of stopping.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We need to load our audio before we change whether or not it will loop.
    audio:Load("test.wav")
    
    // We now enable looping. This will make the sound repeat forever until we
    // stop it or call "audio:DisableLooping()".
    audio:EnableLooping()

EnablePhysics(boolean flag)

Parameters

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

FastMoving(boolean flag)

Parameters

FinishCollision(Libraries.Interface.Item item)

This action is used to indicate that two items that were previously colliding no longer are. The FinishCollision action should be called on both Items involved, with the other item passed as a parameter to the action. Note that this action does nothing by default, but classes that inherit from Item may override it.

Example Code

use Libraries.Interface.Item

        Item collider1
        Item collider2
        collider1:FinishCollision(collider2)
        collider2:FinishCollision(collider1)

Parameters

Focus()

This action sets focus on this Item. If the Item is not focusable, it will instead look through the parent hierarchy and set focus on the first focusable ancestor. If no focusable Item can be found, this action will have no effect.

GainedFocus(Libraries.Interface.Events.FocusEvent event)

This action is fired if the item received the focus.

Parameters

GetAccessibilityCode()

This action returns the current accessiblity code for this Item

Return

integer:

GetAccessibilityType()

This action returns the name of the accessiblity code for this Item as Text

Return

text:

GetAngularDamping()

Return

number

GetAngularFactor()

Return

number

GetAngularVelocity()

Return

Libraries.Compute.Vector3

GetBalance()

GetBalance will return the current balance value of the sound. A value of -1 represents audio fully from the left speaker. A value of 1 represents audio fully from the right speaker. A value of 0 represents audio equally from both speakers.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We always have to load a sound before use.
    audio:Load("ding.wav")

    // For this example, we will set the balance to -1.
    audio:SetBalance(-1)

    // We can get the balance back as a number using the GetBalance() action.
    number balance = audio:GetBalance()

Return

number:

GetBoundingBox(integer childIndex)

Item3D child = undefin

Parameters

Return

Libraries.Game.BoundingBox:

GetCenterOfMassPosition()

Return

Libraries.Compute.Vector3

GetCenterOfMassTransform()

Return

Libraries.Game.Collision.PhysicsPosition3D

GetCollisionGroupFlag()

Return

boolean

GetCollisionGroupIndex()

Return

integer

GetCollisionList()

Return

Libraries.Game.Collision.CollisionEdge3D

GetCollisionTransform()

Return

Libraries.Game.Collision.PhysicsPosition3D

GetCollisionTransform0()

Return

Libraries.Game.Collision.PhysicsPosition3D

GetCurrentAudioSamples()

This action returns which AudioSample is currently queued when used on an Audio object that is streaming AudioSamples.

Return

Libraries.Sound.AudioSamples: The currently queued AudioSamples.

GetDefaultMaximumVolumeDistance()

This action returns the default maximum volume distance for all newly created Audio objects. It will not change the maximum volume distance of any Audio objects that have already been loaded.

Example Code

use Libraries.Sound.Audio

    Audio audio1
    Audio audio2

    // We test to see what the default maximum volume distance is using audio1.
    output "The default rolloff rate is " + audio1:GetDefaultMaximumVolumeDistance()

    audio2:SetDefaultMaximumVolumeDistance(0.5)

    // Even though we changed the default max volume distance using audio2,
    // we can still see the changed default using audio1.
    output "Now the default rolloff rate is " + audio1:GetDefaultMaximumVolumeDistance()

Return

number: The default maximum volume distance to use for all newly loaded Audio objects.

GetDefaultRolloffRate()

This action returns the default rolloff rate of newly loaded Audio objects. It can be changed using the SetDefaultRolloffRate action. The default value is shared across all Audio objects.

Example Code

use Libraries.Sound.Audio

    Audio audio1
    Audio audio2

    // We test to see what the default rolloff rate is using audio1.
    output "The default rolloff rate is " + audio1:GetDefaultRolloffRate()

    audio2:SetDefaultRolloffRate(0.5)

    // Even though we changed the default rolloff rate using audio2,
    // we can still see the changed default using audio1.
    output "Now the default rolloff rate is " + audio1:GetDefaultRolloffRate()

Return

number:

GetDepth()

GetDepth will return the depth of this Item3D.

Example Code

use Libraries.Interface.Item3D

        Item3D myItem
        myItem:SetDepth(50)
        number depth = myItem:GetDepth()

Return

number: The depth of this item.

GetDescription()

This action returns the current internal description of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetDescription("Used for demo purposes.")
        output "My item's description is : " + item:GetDescription()

Return

text:

GetDimensions()

GetDimensions will return a Vector3 object containing the width, height, and depth of this Item3D object.

Example Code

use Libraries.Interface.Item3D
        use Libraries.Compute.Vector3

        Item3D myItem
        myItem:SetWidth(50)
        Vector3 vector = myItem:GetDimensions()

Return

Libraries.Compute.Vector3: A new Vector3 object containing the width, height, and depth of this item.

GetFade()

GetFade will return the current fade value of the sound. A value of -1 represents audio fully from the rear channel. A value of 1 represents audio fully from the front channel. A value of 0 represents audio equally from both channels.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We always have to load a sound before use.
    audio:Load("ding.wav")

    // For this example, we will set the fade to -1.
    audio:SetFade(-1)

    // We can get the fade back as a number using the GetFade() action.
    number fade = audio:GetFade()

Return

number:

GetFocusListeners()

This action returns an Iterator containing all of the FocusListeners that have been added to this Item using the AddFocusListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered FocusListeners.

GetForce()

Return

Libraries.Compute.Vector3

GetFriction()

Return

number

GetGlobalPosition()

This action will return the global position of the Item3D as a Vector3. This is the item's position plus any offset applied by its relation to its parent (if it has one).

Example Code

use Libraries.Interface.Item3D
        use Libraries.Compute.Vector3
        Item3D myItem
        Item3D parentItem
        parentItem:SetPosition(50, 40, 30)
        myItem:SetPosition(25, 30, 45)
        parentItem:Add(myItem)
        Vector3 position = myItem:GetGlobalPosition()

Return

Libraries.Compute.Vector3: A new Vector3 object containing the global coordinates of this Item (not relative to any parent).

GetGlobalX()

This action will return the global x coordinate of the Item3D. This is the item's position plus any offset applied by its relation to its parent (if it has one).

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        Item3D parentItem
        parentItem:SetX(50)
        myItem:SetX(25)
        parentItem:Add(myItem)
        number x = myItem:GetGlobalX()

Return

number: The global X coordinate of this Item (not relative to any parent).

GetGlobalY()

This action will return the global y coordinate of the Item3D. This is the item's position plus any offset applied by its relation to its parent (if it has one).

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        Item3D parentItem
        parentItem:SetY(50)
        myItem:SetY(25)
        parentItem:Add(myItem)
        number y = myItem:GetGlobalY()

Return

number: The global Y coordinate of this Item (not relative to any parent).

GetGlobalZ()

This action will return the global z coordinate of the Item3D. This is the item's position plus any offset applied by its relation to its parent (if it has one).

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        Item3D parentItem
        parentItem:SetZ(50)
        myItem:SetZ(25)
        parentItem:Add(myItem)
        number z = myItem:GetGlobalZ()

Return

number: The global Z coordinate of this Item (not relative to any parent).

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetHeight()

GetHeight will return the height of this Item3D.

Example Code

use Libraries.Interface.Item3D

        Item3D myItem
        myItem:SetHeight(50)
        number height = myItem:GetHeight()

Return

number: The height of this item.

GetInputGroup()

This action returns the input group for this Item. When used with the Game libraries, this tag describes what InputTable (if any) can interact with this Item due to input.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetInputGroup("arrowKeys")
        output "My item's input group is : " + item:GetInputGroup()

Return

text: The input group tag being used by this Item.

GetInputTable()

Return

Libraries.Game.InputTable:

GetInterpolatedAngularVelocity()

Return

Libraries.Compute.Vector3

GetInterpolatedLinearVelocity()

Return

Libraries.Compute.Vector3

GetInterpolationTransform()

Return

Libraries.Game.Collision.PhysicsPosition3D

GetInterpolationWorldTransform()

Return

Libraries.Game.Collision.PhysicsPosition3D

GetInverseInertiaLocal()

Return

Libraries.Compute.Vector3

GetInverseInertiaWorld()

Return

Libraries.Compute.Matrix3

GetInverseMass()

Return

number

GetItem(integer index)

This action returns an Item3D that was previously added to this Item3D by finding it at the given index in the internal array of children Items.

Example Code

use Libraries.Interface.Item3D

        Item3D parentItem
        Item3D child1
        Item3D child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        Item3D temp = parentItem:GetItem(0)

Parameters

Return

Libraries.Interface.Item3D: The child Item stored at the index.

GetItemCount()

This action returns the number of items contained in this Item3D.

Example Code

use Libraries.Interface.Item3D

        Item3D parentItem
        Item3D child1
        Item3D child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        integer size = parentItem:GetItemCount()

Return

integer: The number of children in this Item3D.

GetItems()

This action returns an iterator containing all the items contained in this Item3D.

Example Code

use Libraries.Interface.Item3D
        use Libraries.Containers.Iterator

        Item3D parentItem
        Item3D child1
        Item3D child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        Iterator<Item3D> iterator = parentItem:GetItems()

Return

Libraries.Containers.Iterator: An iterator containing all children in this Item3D.

GetJointList()

Return

Libraries.Game.Physics.Joints.JointEdge3D

GetLayer()

This action returns the current Layer3D that this Item3D is a part of in the Game libraries.

Return

Libraries.Game.Layer3D: The current Layer3D that this Item3D is attached to (if any).

GetLights(Libraries.Containers.Array<Libraries.Game.Graphics.Light> array)

This action will find all of the Light objects contained in the children hierarchy of this Item3D and add it to the end of the given array. If this object is a Light, it will be added to the array first before adding any descendents where are Lights.

Example Code

use Libraries.Interface.Item3D
    use Libraries.Game.Graphics.PointLight
    use Libraries.Game.Graphics.Light
    use Libraries.Containers.Array

    Item3D item
    PointLight light1
    PointLight light2
    item:Add(light1)
    item:Add(light2)
    Array<Light> lightArray
    item:GetLights(lightArray)

Parameters

GetLights()

This action will return an array of all Light objects contained in the children hierarchy of this Item3D. If this object is a Light, it will also be included as the first item in the array.

Example Code

use Libraries.Interface.Item3D
    use Libraries.Game.Graphics.PointLight
    use Libraries.Game.Graphics.Light
    use Libraries.Containers.Array

    Item3D item
    PointLight light1
    PointLight light2
    item:Add(light1)
    item:Add(light2)
    Array<Light> lightArray = item:GetLights()

Return

Libraries.Containers.Array: An array of all Lights stored in this Item3D.

GetLinearDamping()

Return

number

GetLinearVelocity()

Return

Libraries.Compute.Vector3

GetLinearVelocityAtLocalPoint(Libraries.Compute.Vector3 relativePosition)

Parameters

Return

Libraries.Compute.Vector3

GetListenerDirection()

This action will get the direction that the listener is currently facing in.

Example Code

use Libraries.Sound.Audio
        use Libraries.Compute.Vector3

        // We load an audio object and set its position to 1 meter in front of the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 0, 1)

        // Now we set the listener to face the right by calling SetListenerDirection.
        // We can do this using any Audio object - it won't affect the result.
        audio:SetListenerDirection(1, 0, 0)

        // The audio is now located to the left of the listener's "ears", so when we
        // play it, it should play through the left speaker.
        audio:PlayUntilDone()

        // Once we've set the direction of the listener, we can get back each
        // of the values we've set it with using the GetListenerDirection actions.
        // We can do this using any Audio object - it won't affect the result.
        Vector3 direction = audio:GetListenerDirection()
        output "The direction of the listener is " + direction:GetX() + ", " + direction:GetY() + ", " + direction:GetZ()

Return

Libraries.Compute.Vector3:

GetListenerDirectionX()

This action will get the x-component of the direction that the listener is currently facing in.

Example Code

use Libraries.Sound.Audio

        // We load an audio object and set its position to 1 meter in front of the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 0, 1)

        // Now we set the listener to face the right by calling SetListenerDirection.
        // We can do this using any Audio object - it won't affect the result.
        audio:SetListenerDirection(1, 0, 0)

        // The audio is now located to the left of the listener's "ears", so when we
        // play it, it should play through the left speaker.
        audio:PlayUntilDone()

        // Once we've set the direction of the listener, we can get back each
        // of the values we've set it with using the GetListenerDirection actions.
        // We can do this using any Audio object - it won't affect the result.
        number x = audio:GetListenerDirectionX()
        output "The direction of the listener on the x-axis is " + x

Return

number:

GetListenerDirectionY()

This action will get the y-component of the direction that the listener is currently facing in.

Example Code

use Libraries.Sound.Audio

        // We load an audio object and set its position to 1 meter in front of the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 0, 1)

        // Now we set the listener to face the right by calling SetListenerDirection.
        // We can do this using any Audio object - it won't affect the result.
        audio:SetListenerDirection(1, 0, 0)

        // The audio is now located to the left of the listener's "ears", so when we
        // play it, it should play through the left speaker.
        audio:PlayUntilDone()

        // Once we've set the direction of the listener, we can get back each
        // of the values we've set it with using the GetListenerDirection actions.
        // We can do this using any Audio object - it won't affect the result.
        number y = audio:GetListenerDirectionY()
        output "The direction of the listener on the y-axis is " + y

Return

number:

GetListenerDirectionZ()

This action will get the z-component of the direction that the listener is currently facing in.

Example Code

use Libraries.Sound.Audio

        // We load an audio object and set its position to 1 meter in front of the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 0, 1)

        // Now we set the listener to face the right by calling SetListenerDirection.
        // We can do this using any Audio object - it won't affect the result.
        audio:SetListenerDirection(1, 0, 0)

        // The audio is now located to the left of the listener's "ears", so when we
        // play it, it should play through the left speaker.
        audio:PlayUntilDone()

        // Once we've set the direction of the listener, we can get back each
        // of the values we've set it with using the GetListenerDirection actions.
        // We can do this using any Audio object - it won't affect the result.
        number z = audio:GetListenerDirectionZ()
        output "The direction of the listener on the z-axis is " + z

Return

number:

GetListenerPosition()

This action will return the current coordinates of the listener in virtual 3D space. The returned result will be stored in a new Vector3.

Example Code

use Libraries.Sound.Audio
        use Libraries.Compute.Vector3

        // In this example, we will use two audio objects. 
        Audio buzzer
        buzzer:Load("Buzzer.wav")
        Audio bell
        bell:Load("Bell.ogg")

        // We will now set the listener's position. Although we can set all 3
        // coordinates with this action, we will set just the x-coordinate for
        // this example. This is the same as using SetListenerX(3)
        Vector3 vector
        vector:Set(3, 0, 0)
        buzzer:SetListenerPosition(vector)

        // Now when we play our audio, both sounds should come from the left
        // side in 3D space - this is because both sounds are at their default
        // location of 0, 0, 0, but the listener is 3 units to the right.
        buzzer:PlayUntilDone()
        bell:PlayUntilDone()

        // We can get the listener's position back by using GetListenerPosition.
        // It doesn't matter what Audio object we call this from - the result is the same.
        Vector3 position = bell:GetListenerPosition()
        output "Listener position is " + position:GetX() + ", " + position:GetY() + ", " + position:GetZ()

Return

Libraries.Compute.Vector3:

GetListenerUp()

This action will get the direction that the listener currently considers "up".

Example Code

use Libraries.Sound.Audio
        use Libraries.Compute.Vector3

        // We load an audio object and set its position to 1 meter above the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 1, 0)

        // The listener's default direction is straight forward, with the "up" direction
        // being along the positive y-axis. For this example, we'll set the "up"
        // direction to be along the negative x-axis. This effectively means the
        // listener is lying on their left side, with their left ear pointed towards the
        // ground and their right ear pointed up towards the sky.
        // We can do this using any Audio object - it won't affect the result.
        audio:SetListenerUp(-1, 0, 0)

        // Although the sound is located above the listener, since the listener has
        // their right ear pointed upwards, the audio will play through the right speaker.
        audio:PlayUntilDone()

        // We can retrieve the direction the listener considers to be "up" at
        // any time by using the GetListenerUp actions. Just like setting the
        // "up", it doesn't matter which Audio object is used to retrieve it.
        Vector3 up = audio:GetListenerUp()
        output "The up direction of the audio along the x-axis is " + up:GetX() + ", " + up:GetY() + ", " + up:GetZ()

Return

Libraries.Compute.Vector3:

GetListenerUpX()

This action will get the x-component of the direction that the listener currently considers "up".

Example Code

use Libraries.Sound.Audio

        // We load an audio object and set its position to 1 meter above the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 1, 0)

        // The listener's default direction is straight forward, with the "up" direction
        // being along the positive y-axis. For this example, we'll set the "up"
        // direction to be along the negative x-axis. This effectively means the
        // listener is lying on their left side, with their left ear pointed towards the
        // ground and their right ear pointed up towards the sky.
        // We can do this using any Audio object - it won't affect the result.
        audio:SetListenerUp(-1, 0, 0)

        // Although the sound is located above the listener, since the listener has
        // their right ear pointed upwards, the audio will play through the right speaker.
        audio:PlayUntilDone()

        // We can retrieve the direction the listener considers to be "up" at
        // any time by using the GetListenerUp actions. Just like setting the
        // "up", it doesn't matter which Audio object is used to retrieve it.
        number x = audio:GetListenerUpX()
        output "The up direction of the audio along the x-axis is " + x

Return

number:

GetListenerUpY()

This action will get the y-component of the direction that the listener currently considers "up".

Example Code

use Libraries.Sound.Audio

        // We load an audio object and set its position to 1 meter above the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 1, 0)

        // The listener's default direction is straight forward, with the "up" direction
        // being along the positive y-axis. For this example, we'll set the "up"
        // direction to be along the negative x-axis. This effectively means the
        // listener is lying on their left side, with their left ear pointed towards the
        // ground and their right ear pointed up towards the sky.
        // We can do this using any Audio object - it won't affect the result.
        audio:SetListenerUp(-1, 0, 0)

        // Although the sound is located above the listener, since the listener has
        // their right ear pointed upwards, the audio will play through the right speaker.
        audio:PlayUntilDone()

        // We can retrieve the direction the listener considers to be "up" at
        // any time by using the GetListenerUp actions. Just like setting the
        // "up", it doesn't matter which Audio object is used to retrieve it.
        number y = audio:GetListenerUpY()
        output "The up direction of the audio along the y-axis is " + y

Return

number:

GetListenerUpZ()

This action will get the z-component of the direction that the listener currently considers "up".

Example Code

use Libraries.Sound.Audio

        // We load an audio object and set its position to 1 meter above the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 1, 0)

        // The listener's default direction is straight forward, with the "up" direction
        // being along the positive y-axis. For this example, we'll set the "up"
        // direction to be along the negative x-axis. This effectively means the
        // listener is lying on their left side, with their left ear pointed towards the
        // ground and their right ear pointed up towards the sky.
        // We can do this using any Audio object - it won't affect the result.
        audio:SetListenerUp(-1, 0, 0)

        // Although the sound is located above the listener, since the listener has
        // their right ear pointed upwards, the audio will play through the right speaker.
        audio:PlayUntilDone()

        // We can retrieve the direction the listener considers to be "up" at
        // any time by using the GetListenerUp actions. Just like setting the
        // "up", it doesn't matter which Audio object is used to retrieve it.
        number z = audio:GetListenerUpZ()
        output "The up direction of the audio along the z-axis is " + z

Return

number:

GetListenerVelocity()

This action will return the current velocity of the listener in virtual 3D space. The returned result will be stored in a new Vector3.

Example Code

use Libraries.Sound.Audio
        use Libraries.Compute.Vector3

        Audio flute
        flute:Load("Flute.ogg")

        Vector3 vector
        vector:Set(15, 8, 11)
        
        // The listener is given a velocity of 15 meters per second along the
        // x-axis, 8 meters per second along the y-axis, and 11 meters-per-second
        // along the z-axis.
        flute:SetListenerVelocity(vector)

        // We can now retrieve the velocity of the listener by using
        // GetListenerVelocity. It doesn't matter what Audio object we
        // call this from - the result is the same.
        Vector3 velocity = flute:GetListenerVelocity()
        output "The listener's velocity is " + velocity:GetX() + ", " + velocity:GetY() + ", " + velocity:GetZ()

Return

Libraries.Compute.Vector3:

GetListenerVelocityX()

This action will return the current x velocity of the listener in virtual 3D space.

Example Code

use Libraries.Sound.Audio

        Audio flute
        flute:Load("Flute.ogg")
        
        // The listener is given a velocity of 15 meters per second along the
        // x-axis.
        flute:SetListenerVelocityX(15)

        // We can now retrieve the velocity of the listener along the x-axis by
        // using GetListenerVelocityX. It doesn't matter what Audio object we
        // call this from - the result is the same.
        number x = flute:GetListenerVelocityX()
        output "The listener's x velocity is " + x

Return

number:

GetListenerVelocityY()

This action will return the current y velocity of the listener in virtual 3D space.

Example Code

use Libraries.Sound.Audio

        Audio flute
        flute:Load("Flute.ogg")
        
        // The listener is given a velocity of 8 meters per second along the
        // y-axis.
        flute:SetListenerVelocityY(8)

        // We can now retrieve the velocity of the listener along the y-axis by
        // using GetListenerVelocityY. It doesn't matter what Audio object we
        // call this from - the result is the same.
        number y = flute:GetListenerVelocityY()
        output "The listener's y velocity is " + y

Return

number:

GetListenerVelocityZ()

This action will return the current z velocity of the listener in virtual 3D space.

Example Code

use Libraries.Sound.Audio

        Audio flute
        flute:Load("Flute.ogg")
        
        // The listener is given a velocity of 11 meters per second along the
        // z-axis.
        flute:SetListenerVelocityZ(11)

        // We can now retrieve the velocity of the listener along the z-axis by
        // using GetListenerVelocityZ. It doesn't matter what Audio object we
        // call this from - the result is the same.
        number z = flute:GetListenerVelocityZ()
        output "The listener's z velocity is " + z

Return

number:

GetListenerX()

This action will return the current x coordinate of the listener in virtual 3D space.

Example Code

use Libraries.Sound.Audio

        // In this example, we will use two audio objects. 
        Audio buzzer
        buzzer:Load("Buzzer.wav")
        Audio bell
        bell:Load("Bell.ogg")

        // We will now set the listener's x position. We could do this with
        // either of our audio objects.
        buzzer:SetListenerX(3)

        // Now when we play our audio, both sounds should come from the left
        // side in 3D space - this is because both sounds are at their default
        // location of 0, 0, 0, but the listener is 3 units to the right.
        buzzer:PlayUntilDone()
        bell:PlayUntilDone()

        // We can get the listener's x position back by using GetListenerX.
        // It doesn't matter what Audio object we call this from - the result is the same.
        number x = bell:GetListenerX()
        output "Listener x position is " + x

Return

number:

GetListenerY()

This action will return the current x coordinate of the listener in virtual 3D space.

Example Code

use Libraries.Sound.Audio

        // In this example, we will use two audio objects. 
        Audio buzzer
        buzzer:Load("Buzzer.wav")
        Audio bell
        bell:Load("Bell.ogg")

        // We will now set the listener's x position. We could do this with
        // either of our audio objects.
        buzzer:SetListenerX(3)

        // Now when we play our audio, both sounds should come from the left
        // side in 3D space - this is because both sounds are at their default
        // location of 0, 0, 0, but the listener is 3 units to the right.
        buzzer:PlayUntilDone()
        bell:PlayUntilDone()

        // We can get the listener's y position back by using GetListenerY.
        // It doesn't matter what Audio object we call this from - the result is the same.
        number y = bell:GetListenerY()
        output "Listener y position is " + y

Return

number:

GetListenerZ()

This action will return the current x coordinate of the listener in virtual 3D space.

Example Code

use Libraries.Sound.Audio

        // In this example, we will use two audio objects. 
        Audio buzzer
        buzzer:Load("Buzzer.wav")
        Audio bell
        bell:Load("Bell.ogg")

        // We will now set the listener's x position. We could do this with
        // either of our audio objects.
        buzzer:SetListenerX(3)

        // Now when we play our audio, both sounds should come from the left
        // side in 3D space - this is because both sounds are at their default
        // location of 0, 0, 0, but the listener is 3 units to the right.
        buzzer:PlayUntilDone()
        bell:PlayUntilDone()

        // We can get the listener's z position back by using GetListenerZ.
        // It doesn't matter what Audio object we call this from - the result is the same.
        number z = bell:GetListenerZ()
        output "Listener z position is " + z

Return

number:

GetMass()

Return

number

GetMaximumVolumeDistance()

The GetMaximumVolumeDistance action returns how far away the listener may be from the Audio and still hear the Audio at full volume. When a new Audio object is created, its maximum volume distance is equal to the current default distance, which begins as 1.0 and can be set by calling SetDefaultMaximumVolumeDistance().

Example Code

use Libraries.Sound.Audio

    Audio audio
    audio:Load("Chime.wav")
    // Output the starting maximum volume distance of the audio.
    output "The maximum volume distance is " + audio:GetMaximumVolumeDistance()

Return

number: The distance from this Audio where it may be heard at full volume.

GetMouseListeners()

This action returns an Iterator containing all of the MouseListeners that have been added to this Item using the AddMouseListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered MouseListeners.

GetMouseMovementListeners()

This action returns an Iterator containing all of the MouseMovementListeners that have been added to this Item using the AddMouseMovementListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered MouseMovementListeners.

GetMouseWheelListeners()

This action returns an Iterator containing all of the MouseWheelListeners that have been added to this Item using the AddMouseWheelListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered MouseWheelListeners.

GetName()

This action returns the current internal name of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetName("My Item")
        output "My item's name is " + item:GetName()

Return

text:

GetNextFocus()

This action returns the next focus item. When this Item has the focus and the user requests the focus to advance (e.g. by pressing the tab key), the returned value is the next item to receive that focus, if it is defined. If it isn't defined, the focus can not advance from this Item.

Return

Libraries.Interface.Item: The next Item to receive focus after this one.

GetNode(integer index)

Parameters

Return

Libraries.Game.Collision.Item3DNode

GetNodeCount()

transform:Translate(xAmount, yAmount, -zAmoun

Return

integer:

GetNodes()

Return

Libraries.Containers.Array

GetOffsetX()

This action returns the X offset of the Item. The offset tells the Item where to relate its X position to. In other words, the X offset is where an X coordinate of 0 is for this Item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:SetOffsetX(100)
        number offset = myItem:GetOffsetX()

Return

number: The current X offset.

GetOffsetY()

This action returns the Y offset of the item. The offset tells the Item where to relate its Y position to. In other words, the Y offset is where a Y coordinate of 0 is for this item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:SetOffsetY(75)
        number offset = myItem:GetOffsetY()

Return

number: The current Y offset.

GetOffsetZ()

This action returns the Z offset of the item. The offset tells the Item where to relate its Z position to. In other words, the Z offset is where a Z coordinate of 0 is for this item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:SetOffsetZ(75)
        number offset = myItem:GetOffsetZ()

Return

number: The current Z offset.

GetOrientation()

Return

Libraries.Compute.Quaternion

GetParent()

This action returns the parent of this Item3D. An Item3D gets a parent when it is added to another Item using the Add action.

Example Code

use Libraries.Interface.Item3D

        Item3D parentItem
        Item3D child
        parentItem:Add(child)
        Item3D item = child:GetParent()

Return

Libraries.Interface.Item3D: The parent Item.

GetPhysicsProperties()

Return

Libraries.Game.Physics.PhysicsProperties3D

GetPitch()

Returns the currently set pitch. The default pitch value is 1.0.

Example Code

use Libraries.Sound.Audio

    Audio audio
    audio:Load("Chime.wav")
    // We will play the sound at 75% of its normal pitch.
    audio:SetPitch(0.75)
    // We can get the pitch value back using GetPitch().
    output "The audio is playing at " + audio:GetPitch() + " of its normal pitch value."

Return

number: The currently set pitch value.

GetPosition()

GetPosition will return a Vector3 object containing the X, Y, and Z coordinates of this Audio3D object. Note that if this Audio3D has been added to an Item3D, then this coordinate is relative to the parent item - to get the non-relative coordinates, use the GetGlobalPosition() action instead.

Example Code

use Libraries.Game.Audio3D
        use Libraries.Compute.Vector3

        Audio3D sound
        sound:SetX(50)
        Vector3 vector = sound:GetPosition()

Return

Libraries.Compute.Vector3:

GetPreviousFocus()

This action returns the previous focus item. When this Item has the focus and the user requests the focus to move backwards (e.g. by pressing shift & tab), the returned value is the previous item to receive that focus, if it is defined. If it isn't defined, the focus can not move backwards from this Item.

Return

Libraries.Interface.Item: The previous Item to receive focus before this one.

GetPushVelocity()

Return

Libraries.Compute.Vector3

GetResponsiveness()

Return

integer

GetRestitution()

Return

number

GetRolloffRate()

The GetRolloffRate action returns the rate at which 3D positional audio becomes quieter when positioned far away from the listener. When an Audio object is created, its rolloff rate is equal to the default value provided by GetDefaultRolloffRate, which begins at 1.0 (but may be changed by the user). Lower rolloff rates cause the sound to fade more slowly over long distances, and higher rolloff rates cause sound to fade more quickly. The rolloff value is always positive.

Example Code

use Libraries.Sound.Audio

    // We create and load audio1 before changing the default rolloff rate.
    Audio audio1
    audio1:Load("Sample1.wav")
    output "Before changing the default rate, audio1 has a rolloff rate of " + audio1:GetRolloffRate()

    audio1:SetDefaultRolloffRate(0.25)

    // We create and load audio2 after changing the default rolloff rate.
    Audio audio2
    audio2:Load("Sample2.wav")
    output "After changing the default rate, audio1 has a rolloff rate of " + audio1:GetRolloffRate()
    output "audio2 has a rolloff rate of " + audio2:GetRolloffRate()

Return

number: The current rolloff rate of this Audio.

GetRotation()

GetRotation gets the current degree of rotation of the sound. Using Balance, Fade, Rotation, or X,Y,Z coordinates are all exclusive of each other, and using one will override any others used previously.

Example Code

use Libraries.Sound.Audio

        // To use audio, we'll first need to create an object for it.
        Audio audio

        // We always have to load a sound before use.
        audio:Load("noise.ogg")

        // For this example, we will rotate the sound so it is to the right of
        // the listener.
        audio:SetRotation(90)

        // We can get the rotation back as a number with GetRotation().
        number rotation = audio:GetRotation()

Return

number:

GetSampleOffset()

This action returns how many samples have been played from the Audio. This is supported if a file has been loaded for non-streaming Audio, or if the Audio is streaming AudioSample objects. If the file is not playing or paused then this will return 0.

Return

integer: The number of samples that have been played.

GetShape()

vector3:Normalize

Return

Libraries.Game.Collision.Shapes.CollisionShape3D:

GetShapeType()

Vector3 localOffset = child:GetGlobalPosition

Return

integer:

GetSleepTime()

Return

number

GetTimeOfImpact()

Source: http://answers.unity3d.com/storage/temp/12048-lefthandedtorighthanded.p

Return

number:

GetTorque()

Return

Libraries.Compute.Vector3

GetTouchListeners()

This action returns an Iterator containing all of the TouchListeners that have been added to this Item using the AddTouchListener action.

Return

Libraries.Containers.Iterator: An iterator containing all of the registered TouchListeners.

GetTransform()

This action will return the Matrix4 containing the transformations applied to the Item3D, including its global position, rotation, and scaling.

Example Code

use Libraries.Interface.Item3D
        use Libraries.Compute.Matrix4
        Item3D myItem
        Matrix4 matrix = myItem:GetTransform()

Return

Libraries.Compute.Matrix4: The Matrix4 used by this item to store and calculate transformations.

GetTurnVelocity()

Return

Libraries.Compute.Vector3

GetVelocity()

GetVelocity returns a Vector3 object describing the velocity of this Audio object in 3D space. The velocity is measured in meters per second. The velocity must be set manually - it will NOT be calculated automatically!

Return

Libraries.Compute.Vector3:

GetVelocityX()

GetVelocityX returns the velocity of this Audio object along the X axis in 3D space. The velocity is measured in meters per second. The velocity must be set manually - it will NOT be calculated automatically!

Example Code

use Libraries.Sound.Audio

        Audio audio
        audio:Load("Tone.wav")

        audio:SetVelocityX(30)

        number speed = audio:GetVelocityX()

Return

number:

GetVelocityY()

GetVelocityY returns the velocity of this Audio object along the Y axis in 3D space. The velocity is measured in meters per second. The velocity must be set manually - it will NOT be calculated automatically!

Example Code

use Libraries.Sound.Audio

        Audio audio
        audio:Load("Tone.wav")

        audio:SetVelocityY(30)

        number speed = audio:GetVelocityY()

Return

number:

GetVelocityZ()

GetVelocityZ returns the velocity of this Audio object along the Z axis in 3D space. The velocity is measured in meters per second. The velocity must be set manually - it will NOT be calculated automatically!

Example Code

use Libraries.Sound.Audio

        Audio audio
        audio:Load("Tone.wav")

        audio:SetVelocityZ(30)

        number speed = audio:GetVelocityZ()

Return

number:

GetVolume()

The GetVolume action returns the currently set volume. A number value of 1.0 represents 100% of normal volume.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We always have to load a sound before use.
    audio:Load("ding.wav")

    // For this example, we will set the audio to 50%, or half, volume.
    audio:SetVolume(0.5)

    // We can get the volume back as a number using the GetVolume() action.
    number volume = audio:GetVolume()

Return

number:

GetWidth()

GetWidth will return the width of this Item3D.

Example Code

use Libraries.Interface.Item3D

        Item3D myItem
        myItem:SetWidth(50)
        number width = myItem:GetWidth()

Return

number: The width of this item.

GetX()

GetX will return the X coordinate of this Audio3D in 3D space. Note that if this Audio3D has been added to an Item3D, then this coordinate is relative to the parent item - to get the non-relative X coordinate, use the GetGlobalX() action instead.

Example Code

use Libraries.Game.Audio3D

        Audio3D sound
        sound:SetX(50)
        number x = sound:GetX()

Return

number:

GetY()

GetY will return the Y coordinate of this Audio3D in 3D space. Note that if this Audio3D has been added to an Item3D, then this coordinate is relative to the parent item - to get the non-relative Y coordinate, use the GetGlobalY() action instead.

Example Code

use Libraries.Game.Audio3D

        Audio3D sound
        sound:SetY(50)
        number y = sound:GetY()

Return

number:

GetZ()

GetZ will return the Z coordinate of this Audio3D in 3D space. Note that if this Audio3D has been added to an Item3D, then this coordinate is relative to the parent item - to get the non-relative Z coordinate, use the GetGlobalZ() action instead.

Example Code

use Libraries.Game.Audio3D

        Audio3D sound
        sound:SetZ(50)
        number z = sound:GeZX()

Return

number:

HasMoved()

Return

boolean

Hide()

This action is used to indicate that an Item and all Items that were added to it should not be visible on the screen. Note that the Item class on its own cannot be drawn on the screen, but classes that inherit from it such as Libraries.Game.Graphics.Drawable can be. By default, Items are considered visible.

Example Code

use Libraries.Interface.Item

        Item item
        item:Hide()

IntegrateVelocities(number seconds)

Parameters

InternalApplyImpulse(Libraries.Compute.Vector3 linearComponent, Libraries.Compute.Vector3 angularComponent, number impulseMagnitude)

Parameters

IsCollidable()

Return

boolean

IsDopplerEnabled()

IsDopplerEnabled will return whether or not the audio is currently set to use the doppler effect while playing. Note that by default, audio will use doppler effects.

Example Code

use Libraries.Sound.Audio

        Audio audio
        audio:Load("Ping.ogg")

        // We will store our result in a new boolean variable. Since we haven't
        // changed the doppler for the audio, it should return it's default
        // state, which is true.
        boolean doppler = audio:IsDopplerEnabled()

Return

boolean:

IsEmpty()

This action returns whether or not any items are contained in this Item.

Example Code

use Libraries.Interface.Item3D

        Item3D parentItem
        Item3D child1
        parentItem:Add(child1)
        boolean wasEmpty = parentItem:IsEmpty()

Return

boolean: Whether or not this item contains any children.

IsFastMoving()

Return

boolean

IsFocusable()

This action returns whether or not the Item can currently receive focus. This property can be set with SetFocusable().

Return

boolean:

IsFocused()

The IsFocused action determines if this Item is currently focused, returning true if it is, or false if it is not.

Return

boolean:

IsListenerDopplerEnabled()

This action will return whether or not the listener is currently using its velocity during doppler shift calculations. By default, this will be true.

Example Code

use Libraries.Sound.Audio

        Audio audio

        // We'll store the value in a boolean. Because we haven't disabled the
        // doppler, it should give us the default value, which is true.
        boolean doppler = audio:IsListenerDopplerEnabled()

Return

boolean:

IsLoaded()

The IsLoaded action returns true if the Audio has been loaded with some data from either a file or from AudioSamples, and false if it hasn't been loaded yet.

Example Code

use Libraries.Sound.Audio

    Audio audio
    output "Has audio been loaded yet? " + audio:IsLoaded()
    audio:Load("My_Song.wav")
    output "Has the audio been loaded now? " + audio:IsLoaded()

Return

boolean: True if the Audio has been loaded, false otherwise.

IsLoopingEnabled()

This action will return true or false based on whether or not the audio has been set to loop.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We need to load our audio before we change whether or not it will loop.
    audio:Load("test.wav")
    
    // We now enable looping. This will make the sound repeat forever until we
    // stop it or call "audio:DisableLooping()".
    audio:EnableLooping()

    // To test if looping is enabled, we can use IsLoopingEnabled().
    output "Looping Enabled? " + audio:IsLoopingEnabled()

Return

boolean:

IsNonResponsive()

Return

boolean

IsPhysicsEnabled()

Return

boolean

IsPlaying()

IsPlaying returns a boolean based on the sound's current state. It will return true if the sound is currently playing, or return false if it is not.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We always have to load a sound before use.
    audio:Load("example.ogg")

    // After we load the file, we can play it with a call to Play().
    audio:Play()

    // Because we just told the sound to play, IsPlaying() should return true,
    // so we will enter this conditional statement.
    if audio:IsPlaying()
        output "The audio is playing!"
    end

Return

boolean:

IsResponsive()

Return

boolean

IsRotationAllowed()

Return

boolean

IsShowing()

This action returns whether the Item is currently set to be visible on the screen.

Example Code

use Libraries.Interface.Item

        Item item
        item:Hide()
        boolean visible = item:IsShowing()

Return

boolean: A boolean representing whether or not the Item is currently visible.

IsSimulated()

Return

boolean

IsSimulationRequired()

Return

boolean

IsStreaming()

IsStreaming will return if an audio file was loaded as a streaming audio file. If the audio was loaded normally via the Load action, this will return false. If it was loaded with LoadToStream, it will return true.

Example Code

use Libraries.Sound.Audio

    // We will have two audio objects for this example.
    Audio audio1
    Audio audio2

    // Our first object will not be streamed. Our second one will be.
    audio1:Load("shortSound.ogg")
    audio2:LoadToStream("longSound.ogg")

    // Now we'll output which of these two audio files are set for streaming.
    output "Was audio1 streaming? " + audio1:IsStreaming()
    output "Was audio2 streaming? " + audio2:IsStreaming()

Return

boolean:

IsUnmovable()

Return

boolean

Load(text filePath)

For convenience, Load can also be called using just a file name. This is the same as making a file, calling SetPath, and calling Load with that file. Compare the below example to the example for Load when using a file.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // To load a file that is directly accessible from our project folder, we
    // can skip making a file and just pass the fle location directly to the
    // Load action.
    // This will load the same "beep.ogg" file as in the previous example.
    audio:Load("Sounds/beep.ogg")

    // After we load the file, we can play it with a call to PlayUntilDone().
    audio:PlayUntilDone()

Parameters

Load(Libraries.System.File file)

The Load action will retrieve an audio file to be used by the Audio class. After we've loaded the file, we can play and stop audio, or change how it's played.

Example Code

use Libraries.Sound.Audio
    use Libraries.System.File

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // To load from a file, we'll also need to create one of those.
    File file

    // In this example, we'll load a file called "beep.ogg" from a folder called
    // "Sounds" in our project.
    file:SetPath("Sounds/beep.ogg")

    // Now that our file is set up, we can load that file as audio.
    audio:Load(file)

    // After we load the file, we can play it with a call to PlayUntilDone().
    audio:PlayUntilDone()

Parameters

Load(Libraries.Sound.AudioSamples samples)

The Load action will take the given AudioSamples and load its data into this Audio object for use.

Example Code

use Libraries.Sound.AudioSamples
    use Libraries.Sound.Audio

    AudioSamples samples
    Audio audio

    samples:Load("Chime.wav")
    audio:Load(samples)
    audio:PlayUntilDone()

Parameters

LoadToStream(Libraries.System.File file)

The LoadToStream action will prepare an audio file to be streamed. While a normal Load action makes a copy of the sound so it can be played all at once, the LoadToStream action gets sound data in small chunks without making a copy of the entire thing. To play the next "chunk" of data, use the Stream action. This is useful for long sounds or music, where it could take a long time to copy the entire audio file.

Example Code

use Libraries.Sound.Audio
    use Libraries.System.File

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // To load from a file, we'll also need to create one of those.
    File file

    // In this example, we'll load a file called "LongSong.ogg" from a folder 
    // called "Sounds" in our project.
    file:SetPath("Sounds/LongSong.ogg")

    // Since our audio file is large, it makes sense to load it for streaming.
    audio:LoadToStream(file)

    // After we load the file, we can begin playing it with Play(). This will
    // play the first "chunk" of data we loaded from the stream.
    audio:Play()

    // To play the whole song, we will need to keep loading chunks of data until
    // the song is finished. To do this, we will use the repeat structure.

    // This will continuously call our code until we have played the whole song.
    repeat while audio:IsPlaying()
        // This will load and play the next chunk of sound data.
        audio:Stream()
    end

Parameters

LoadToStream(Libraries.Sound.AudioSamples samples)

The LoadToStream action will take the given AudioSamples and load it into the Audio. Additional samples can then be added to the Audio by using the AddToQueue action.

Example Code

use Libraries.Sound.AudioSamples
    use Libraries.Sound.Audio

    Audio audio

    AudioSamples samples1
    AudioSamples samples2
    AudioSamples samples3

    samples1:Load("Sonata-Part1.ogg")
    samples2:Load("Sonata-Part2.ogg")
    samples3:Load("Sonata-Part3.ogg")

    audio:LoadToStream(samples1)
    audio:AddToQueue(samples2)
    audio:AddToQueue(samples3)

    audio:Play()
    repeat while audio:IsPlaying()
        audio:Stream()
    end

Parameters

LoadToStream(text filePath)

The LoadToStream action can also be called using just a path to where a file is located for convenience. This is the same as making a file, calling SetPath, and calling LoadToStream with that file.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // In this example, we'll load a file called "LongSong.ogg" from a folder 
    // called "Sounds" in our project.
    // Since our audio file is large, it makes sense to load it for streaming.
    audio:LoadToStream("Sounds/LongSong.ogg")

    // After we load the file, we can begin playing it with Play(). This will
    // play the first "chunk" of data we loaded from the stream.
    audio:Play()

    // To play the whole song, we will need to keep loading chunks of data until
    // the song is finished. To do this, we will use the repeat structure.

    // This will continuously call our code until we have played the whole song.
    repeat while audio:IsPlaying()
        // This will load and play the next chunk of sound data.
        audio:Stream()
    end

Parameters

LostFocus(Libraries.Interface.Events.FocusEvent event)

This action is fired if the item lost the focus.

Parameters

Move(Libraries.Compute.Vector3 vector)

The Move action will increase the X, Y, and Z coordinates of this Audio3D by the values inside the given Vector3.

Example Code

use Libraries.Game.Audio3D
        use Libraries.Compute.Vector3

        Audio3D sound
        Vector3 vector
        vector:Set(25, 15, -20)
        sound:SetPosition(50, 25, 80)
        sound:Move(vector)

Parameters

Move(number x, number y, number z)

The Move action will increase the X, Y, and Z coordinates of this Audio3D by the given amounts.

Example Code

use Libraries.Game.Audio3D

        Audio3D sound
        sound:SetPosition(50, 25, 80)
        sound:Move(25, 15, -20)

Parameters

MoveX(number x)

MoveX will increase the X coordinate of this Audio3D by the given amount.

Example Code

use Libraries.Game.Audio3D

        Audio3D sound
        sound:SetX(50)
        sound:MoveX(25)

Parameters

MoveY(number y)

MoveY will increase the Y coordinate of this Audio3D by the given amount.

Example Code

use Libraries.Game.Audio3D

        Audio3D sound
        sound:SetY(50)
        sound:MoveY(25)

Parameters

MoveZ(number z)

MoveZ will increase the Z coordinate of this Audio3D by the given amount.

Example Code

use Libraries.Game.Audio3D

        Audio3D sound
        sound:SetZ(50)
        sound:MoveZ(25)

Parameters

Pause()

The Pause action will temporarily stop playing a sound, and remember where the sound was during its playback. Calling Resume will make the sound play again from where it was paused.

Play()

Once we've prepared our audio file with either the Load or LoadToStream actions, we can play the file. If we prepared the file with Load, using the Play action will play the entire song. If we prepared it with LoadToStream, we use Play to start the sound, then we call Stream() repeatedly to play the rest of the sound.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We will first load a sound normally with the Load command. Most sounds
    // should be loaded this way.
    audio:Load("ShortSound.wav")

    // After we load the file, we can play it with a call to Play().
    audio:Play()

    // We can also use the Play action with streamed audio.
    Audio longAudio
    longAudio:LoadToStream("LongSound.wav")
    
    // Using Play() on longAudio will start the stream. We will have to keep
    // calling Stream() to play the whole sound.

    longAudio:Play()

    repeat while longAudio:IsPlaying()
        longAudio:Stream()
    end

PlayUntilDone()

If you want to make a program wait until your audio has stopped playing to continue, use the PlayUntilDone action. This action won't work on streamed audio, only on audio loaded with the Load() action. The audio file will always play just once, even if looping is enabled. If this action is used on a streaming audio file, nothing will happen.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We will first load a sound normally with the Load command. Most sounds
    // should be loaded this way.
    audio:Load("ShortSound.wav")

    // Now that our file is loaded, we can play the sound.
    audio:PlayUntilDone()
    
    // This output statement will be called after the entire sound has played.
    output "Finished playing audio!"

PredictIntegratedTransform(number seconds, Libraries.Game.Collision.PhysicsPosition3D predictedTransform)

Parameters

ProceedToTransform(Libraries.Game.Collision.PhysicsPosition3D transform)

Parameters

ProcessMouseEvent(Libraries.Interface.Events.MouseEvent event)

This action takes a MouseEvent and distributes it to any MouseListeners, MouseMovementListeners, and MouseWheelListeners that have been added to this Item3D. This action will also set the event to the "handled" state.

Example Code

use Libraries.Interface.Item2D
    use Libraries.Interface.Events.MouseEvent
    use Libraries.Interface.Events.MouseListener
    Item2D myItem
    MouseListener listener
    myItem:AddMouseListener(listener)
    MouseEvent event
    event:eventType = event:CLICKED_MOUSE
    myItem:ProcessMouseEvent(event)

Parameters

ProcessTouchEvent(Libraries.Interface.Events.TouchEvent event)

This action will take a TouchEvent and distribute it to any TouchListeners that have been added to this Item3D. This action will also set the event to the "handled" state.

Example Code

use Libraries.Interface.Item2D
    use Libraries.Interface.Events.TouchEvent
    use Libraries.Interface.Events.TouchListener
    Item2D myItem
    TouchListener listener
    myItem:AddTouchListener(listener)
    TouchEvent event
    event:eventType = event:BEGAN
    myItem:ProcessTouchEvent(event)

Parameters

Remove(integer index)

This action removes an Item that was previously added to this Item by finding it at the given index in the internal array of children Items.

Example Code

use Libraries.Interface.Item

        Item parentItem
        Item child1
        Item child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        parentItem:Remove(0)

Parameters

Return

Libraries.Interface.Item3D: The Item that was removed.

Remove(Libraries.Interface.Item3D removed)

This action removes an Item3D that was previously added to this Item3D.

Example Code

use Libraries.Interface.Item3D

        Item3D parentItem
        Item3D child1
        Item3D child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        parentItem:Remove(child1)

Parameters

Return

boolean: Whether or not the item was found and removed.

RemoveFocusListener(Libraries.Interface.Events.FocusListener listener)

This action removes a FocusListener from the Item. The listener will no longer receive notification if the Item gets a FocusEvent.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.FocusListener
        Item myItem
        FocusListener listener
        myItem:AddFocusListener(listener)
        myItem:RemoveFocusListener(listener)

Parameters

RemoveFromQueue(Libraries.Sound.AudioSamples samples)

The RemoveFromQueue action removes AudioSamples from the data stored in this Audio object. To use this, the Audio must have been initialized for streaming AudioSamples, either by using LoadToStream(AudioSamples) or AddToQueue(AudioSamples). If the requested AudioSamples wasn't present in the Audio (e.g., because it was never queued or because it was queued and already played), then this action will have no effect.

Example Code

use Libraries.Sound.AudioSamples
    use Libraries.Sound.Audio

    Audio audio

    AudioSamples samples1
    AudioSamples samples2
    AudioSamples samples3

    samples1:Load("Sonata-Part1.ogg")
    samples2:Load("Sonata-Part2.ogg")
    samples3:Load("Sonata-Part3.ogg")

    audio:LoadToStream(samples1)
    audio:AddToQueue(samples2)
    audio:AddToQueue(samples3)

    audio:Play()

    // We can remove AudioSamples before or during Audio playback.
    audio:RemoveFromQueue(samples2)

    repeat while audio:IsPlaying()
        audio:Stream()
    end

Parameters

RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)

This action removes a MouseListener from the Item. The listener will no longer receive notification if the Item gets a mouse click event.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseListener
        Item myItem
        MouseListener listener
        myItem:AddMouseListener(listener)
        myItem:RemoveMouseListener(listener)

Parameters

RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)

This action removes a MouseMovementListener from the Item. The listener will no longer receive notification if the Item gets a mouse movement event.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseMovementListener
        Item myItem
        MouseMovementListener listener
        myItem:AddMouseMovementListener(listener)
        myItem:RemoveMouseMovementListener(listener)

Parameters

RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)

This action removes a MouseWheelListener from the Item. The listener will no longer receive notification if the Item gets a mouse wheel event.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.MouseWheelListener
        Item myItem
        MouseWheelListener listener
        myItem:AddMouseWheelListener(listener)
        myItem:RemoveMouseWheelListener(listener)

Parameters

RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)

This action removes a TouchListener from the Item. The listener will no longer receive notification if the Item gets a TouchEvent.

Example Code

use Libraries.Interface.Item
        use Libraries.Interface.Events.TouchListener
        Item myItem
        TouchListener listener
        myItem:AddTouchListener(listener)
        myItem:RemoveTouchListener(listener)

Parameters

RequireSimulation(boolean flag)

Parameters

ResetMass()

Resume()

The Resume action will resume playing an audio file that was paused. If the audio was not paused, this action will have no effect.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We always have to load a sound before use.
    audio:Load("ding.wav")

    // After we load the file, we can play it with a call to Play().
    audio:Play()

    // Now that audio is playing, we can pause it at any time by calling Pause.
    audio:Pause()

    // We can also resume the audio at any time by calling Resume.
    audio:Resume()

Rotate(Libraries.Compute.Vector3 vector, number degrees, boolean rotateChildren)

This action will rotate the Item3D about an axis represented by the given Vector3. The item will be rotated by an angle given in degrees. If the boolean parameter is set to true, and if the Item3D has any children items, they will also be rotated, and their offsets will be adjusted to maintain the same relative position to this item. If the boolean parameter is set to false, only this Item will be rotated.

Example Code

use Libraries.Interface.Item3D
    use Libraries.Compute.Vector3
    Item3D myItem
    Vector3 vector
    vector:Set(5, 2, 1)
    myItem:Rotate(vector, 90, false)

Parameters

Rotate(number rotation)

Rotate increases the degree of rotation of the sound, causing it to progress clockwise around the listener if given a positive value, or counter-clockwise around the listener if the action is given a negative value. Using Balance, Fade, Rotation, or X,Y,Z coordinates are all exclusive of each other, and using one will override any others used previously.

Example Code

use Libraries.Sound.Audio

        // To use audio, we'll first need to create an object for it.
        Audio audio

        // We always have to load a sound before use.
        audio:Load("noise.ogg")

        // For this example, we will rotate the sound so it is to the right of
        // the listener.
        audio:Rotate(90)

        // After we load the file, we can play it with a call to PlayUntilDone().
        audio:PlayUntilDone()

        // Now we will rotate it another 180 degrees, so it will be at 270 degrees.
        audio:Rotate(180)
            
        // We can call PlayUntilDone() again to hear it in its new position.
        audio:PlayUntilDone()

        // Once we're finished with an audio file, we need to let the computer know.
        audio:Dispose()

Parameters

Rotate(Libraries.Compute.Vector3 vector, number degrees)

This action will rotate the Item3D about an axis represented by the given Vector3. The axis is essentially a ray that starts at the center of the item and points outward. The item will then rotate clockwise around that ray. The item will be rotated by an angle given in degrees. If the Item3D has any children items, they will also be rotated, and their offsets will be adjusted to maintain the same relative position to this item.

Example Code

use Libraries.Interface.Item3D
    use Libraries.Compute.Vector3
    Item3D myItem
    Vector3 vector

    // This will rotate the item 90 degrees clockwise around a ray passing 
    // through the item's center and pointing to the right.
    vector:Set(1, 0, 0)
    myItem:Rotate(vector, 90)

    // This will rotate the item 45 degrees clockwise around a ray passing 
    // through the item's center and pointing straight down.
    vector:Set(0, -1, 0)
    myItem:Rotate(vector, 45)

    // This will rotate the item 60 degrees counter-clockwise around a ray  
    // passing through the item's center and pointing to the right.
    vector:Set(1, 0, 0)
    myItem:Rotate(vector, -60)

    // When setting the vector with multiple non-zero values, each value is
    // relative to each other. Since this vector is set with a larger x
    // value than y value, this ray points mostly left and a little upwards.
    vector:Set(3, 1, 0)
    myItem:Rotate(vector, 45)

    // Because the values are relative to each other, this code has the same
    // effect as the last Rotate call we used (because the x value is still
    // 3 times larger than the y value).
    vector:Set(9, 3, 0)
    myItem:Rotate(vector, 45)

Parameters

Rotate(number rotateX, number rotateY, number rotateZ, number degrees)

This action will rotate the Item3D about an axis. The axis is essentially a ray that starts at the center of the item and points outward. The item will then rotate clockwise around that ray. The ray is defined using three numbers, representing which way it points on the x, y, and z planes, respectively. The item will be rotated by an angle given in degrees. If the Item3D has any children items, they will also be rotated, and their offsets will be adjusted to maintain the same relative position to this item.

Example Code

use Libraries.Interface.Item3D
    Item3D myItem

    // This will rotate the item 90 degrees clockwise around a ray passing 
    // through the item's center and pointing to the right.
    myItem:Rotate(1, 0, 0, 90)

    // This will rotate the item 45 degrees clockwise around a ray passing 
    // through the item's center and pointing straight down.
    myItem:Rotate(0, -1, 0, 45)

    // This will rotate the item 60 degrees counter-clockwise around a ray  
    // passing through the item's center and pointing to the right.
    myItem:Rotate(1, 0, 0, -60)

    // When setting the ray with multiple non-zero values, each value is
    // relative to each other. Since this vector is set with a larger x
    // value than y value, this ray points mostly left and a little upwards.
    myItem:Rotate(3, 1, 0, 45)

    // Because the values are relative to each other, this code has the same
    // effect as the last Rotate call we used (because the x value is still
    // 3 times larger than the y value).
    myItem:Rotate(9, 3, 0, 45)

Parameters

Rotate(number rotateX, number rotateY, number rotateZ, number degrees, boolean rotateChildren)

This action will rotate the Item3D about an axis represented by the first 3 given number values. The item will be rotated by an angle given in degrees. If the boolean parameter is set to true, and if the Item3D has any children items, they will also be rotated, and their offsets will be adjusted to maintain the same relative position to this item. If the boolean parameter is set to false, only this Item will be rotated.

Example Code

use Libraries.Interface.Item3D
    Item3D myItem
    myItem:Rotate(5, 2, 1, 90, false)

Parameters

RotateAround(Libraries.Compute.Vector3 point, Libraries.Compute.Vector3 axis, number degrees)

This action will rotate this Item3D clockwise about an axis passing through the given point. The direction of the axis is represented by the given Vector3 object. The children of this Item3D will also be rotated.

Example Code

use Libraries.Interface.Item3D
    use Libraries.Compute.Vector3
    Item3D parentItem
    Item3D child1
    Item3D child2

    parentItem:Add(child1)
    parentItem:Add(child2)

    // We will rotate about the point 0, 0, 0 for this example.
    Vector3 point
    point:Set(0, 0, 0)

    Vector3 axis

    // This will rotate the item and its children 90 degrees clockwise around a ray passing 
    // through the given point and pointing to the right.
    axis:Set(1, 0, 0)
    myItem:RotateAround(point, axis, 90)

    // This will rotate the item and its children 45 degrees clockwise around a ray passing 
    // through the given point and pointing straight down.
    axis:Set(0, -1, 0, 45)
    myItem:RotateAround(point, axis, 45)

    // This will rotate the item and its children 60 degrees counter-clockwise around a ray  
    // passing through the given point and pointing to the right.
    axis:Set(1, 0, 0)
    myItem:RotateAround(point, axis, -60)

    // When setting the ray with multiple non-zero values, each value is
    // relative to each other. Since this vector is set with a larger x
    // value than y value, this ray points mostly left and a little upwards.
    axis:Set(3, 1, 0)
    myItem:RotateAround(point, axis, 45)

    // Because the values are relative to each other, this code has the same
    // effect as the last Rotate call we used (because the x value is still
    // 3 times larger than the y value).
    axis:Set(9, 3, 0)
    myItem:RotateAround(point, axis, 45)

Parameters

RotateAround(Libraries.Compute.Vector3 point, Libraries.Compute.Vector3 axis, number degrees, boolean rotateChildren)

This action will rotate this Item3D clockwise about an axis passing through the given point. The direction of the axis is represented by the given Vector3 object. The last parameter is a boolean that determines whether or not children should also be rotated - a value of true will rotate the children, a value of false will not. Note that the children will still maintain relative position to this item, regardless of the boolean passed.

Example Code

use Libraries.Interface.Item3D
    use Libraries.Compute.Vector3
    Item3D parentItem
    Item3D child1
    Item3D child2

    parentItem:Add(child1)
    parentItem:Add(child2)

    // We will rotate about the point 0, 0, 0 for this example.
    Vector3 point
    point:Set(0, 0, 0)

    Vector3 axis

    // This will rotate the item and its children 90 degrees clockwise around a ray passing 
    // through the given point and pointing to the right.
    axis:Set(1, 0, 0)
    myItem:RotateAround(point, axis, 90, true)

    // This will rotate the item and its children 45 degrees clockwise around a ray passing 
    // through the given point and pointing straight down.
    axis:Set(0, -1, 0, 45)
    myItem:RotateAround(point, axis, 45, true)

    // This will rotate the item (but not its children) 60 degrees counter-clockwise around a ray  
    // passing through the given point and pointing to the right.
    axis:Set(1, 0, 0)
    myItem:RotateAround(point, axis, -60, false)

    // When setting the ray with multiple non-zero values, each value is
    // relative to each other. Since this vector is set with a larger x
    // value than y value, this ray points mostly left and a little upwards.
    axis:Set(3, 1, 0)
    myItem:RotateAround(point, axis, 45, true)

    // Because the values are relative to each other, this code has the same
    // effect as the last Rotate call we used (because the x value is still
    // 3 times larger than the y value).
    axis:Set(9, 3, 0)
    myItem:RotateAround(point, axis, 45, true)

Parameters

RotateChildren(number rotateX, number rotateY, number rotateZ, number degrees)

This action will rotate all of the children of this Item3D clockwise about an axis passing through this item. The direction of the axis is represented by the given Vector3, and the children will be rotated by the given number of degrees.

Example Code

use Libraries.Interface.Item3D
    Item3D parentItem
    Item3D child1
    Item3D child2

    parentItem:Add(child1)
    parentItem:Add(child2)

    Vector3 axis

    // This will rotate the item's children 90 degrees clockwise around a ray passing 
    // through the item's center and pointing to the right.
    myItem:RotateChildren(1, 0, 0, 90)

    // This will rotate the item's children 45 degrees clockwise around a ray passing 
    // through the item's center and pointing straight down.
    myItem:RotateChildren(0, -1, 0, 45)

    // This will rotate the item's children 60 degrees counter-clockwise around a ray  
    // passing through the item's center and pointing to the right.
    myItem:RotateChildren(1, 0, 0, -60)

    // When setting the ray with multiple non-zero values, each value is
    // relative to each other. Since this vector is set with a larger x
    // value than y value, this ray points mostly left and a little upwards.
    myItem:Rotate(3, 1, 0, 45)

    // Because the values are relative to each other, this code has the same
    // effect as the last Rotate call we used (because the x value is still
    // 3 times larger than the y value).
    myItem:RotateChildren(9, 3, 0, 45)

Parameters

RotateChildren(Libraries.Compute.Vector3 vector, number degrees)

This action will rotate all of the children of this Item3D clockwise about an axis passing through this item. The direction of the axis is represented by the given Vector3, and the children will be rotated by the given number of degrees.

Example Code

use Libraries.Interface.Item3D
    use Libraries.Compute.Vector3
    Item3D parentItem
    Item3D child1
    Item3D child2

    parentItem:Add(child1)
    parentItem:Add(child2)

    Vector3 axis

    // This will rotate the item's children 90 degrees clockwise around a ray passing 
    // through the item's center and pointing to the right.
    axis:Set(1, 0, 0)
    myItem:RotateChildren(axis, 90)

    // This will rotate the item's children 45 degrees clockwise around a ray passing 
    // through the item's center and pointing straight down.
    axis:Set(0, -1, 0)
    myItem:RotateChildren(axis, 45)

    // This will rotate the item's children 60 degrees counter-clockwise around a ray  
    // passing through the item's center and pointing to the right.
    axis:Set(1, 0, 0)
    myItem:RotateChildren(axis, -60)

    // When setting the ray with multiple non-zero values, each value is
    // relative to each other. Since this vector is set with a larger x
    // value than y value, this ray points mostly left and a little upwards.
    axis:Set(3, 1, 0)
    myItem:Rotate(axis, 45)

    // Because the values are relative to each other, this code has the same
    // effect as the last Rotate call we used (because the x value is still
    // 3 times larger than the y value).
    axis:Set(9, 3, 0)
    myItem:RotateChildren(axis, 45)

Parameters

SaveKinematicState(number time)

Parameters

Scale(Libraries.Compute.Vector3 vector)

This action will scale the Item3D by the values of the given Vector3. If the Item3D has any children items, they will also be scaled, and their offsets will be adjusted to maintain the same relative position to this item.

Example Code

use Libraries.Interface.Item3D
    use Libraries.Compute.Vector3
    Item3D myItem
    Vector3 vector
    vector:Set(5, 2, 1)
    myItem:Scale(vector)

Parameters

Scale(Libraries.Compute.Vector3 vector, boolean scaleChildren)

This action will scale the Item3D by values of the given Vector3. If the boolean parameter is set to true, and if the Item3D has any children items, they will also be scaled, and their offsets will be adjusted to maintain the same relative position to this item. If the boolean parameter is set to false, only this Item will be scaled.

Example Code

use Libraries.Interface.Item3D
    use Libraries.Compute.Vector3
    Item3D myItem
    Vector3 vector
    vector:Set(5, 2, 1)
    myItem:Scale(vector, false)

Parameters

Scale(number scaleX, number scaleY, number scaleZ, boolean scaleChildren)

This action will scale the Item3D by the given values. If the boolean parameter is set to true, and if the Item3D has any children items, they will also be scaled, and their offsets will be adjusted to maintain the same relative position to this item. If the boolean parameter is set to false, only this Item will be scaled.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:Scale(5, 2, 1, false)

Parameters

Scale(number scaleX, number scaleY, number scaleZ)

This action will scale the Item3D by the given values. If the Item3D has any children items, they will also be scaled, and their offsets will be adjusted to maintain the same relative position to this item.

Example Code

use Libraries.Interface.Item3D
    Item3D myItem
    myItem:Scale(5, 2, 1)

Parameters

SetAccessibilityCode(integer newAccessibilityCode)

This action changes the accessibility code for this Item. This should be done with care because setting the accessiblity code to the incorrect type can cause accessibility to stop functioning or, in some cases, cause the program to crash.

Parameters

SetAngularDamping(number angularDamping)

Parameters

SetAngularVelocity(Libraries.Compute.Vector3 angularVelocity)

Parameters

SetBalance(number position)

SetBalance will change how the sound is played through stereo speakers or headphones. Values passed to this should always be between -1 and 1. A value of -1 will make the sound play through only the left speaker. A value of 1 will play the sound only through the right speaker. A value of 0 will play the sound equally through both speakers. Using Balance, Fade, Rotation, or X,Y,Z coordinates are all exclusive of each other, and using one will override any others used previously.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We always have to load a sound before use.
    audio:Load("noise.ogg")

    // For this example, we will set the position with the value -1. This will
    // make the sound play through only the left speaker.
    audio:SetBalance(-1)

    // After we load the file, we can play it with a call to PlayUntilDone().
    audio:PlayUntilDone()

    // Once we're finished with an audio file, we need to let the computer know.
    audio:Dispose()

Parameters

SetCenterOfMassTransform(Libraries.Game.Collision.PhysicsPosition3D transform)

Parameters

SetCollidable(boolean flag)

Parameters

SetCollideWithChildren(boolean flag)

Parameters

SetCollisionGroupFlag(boolean flag)

Parameters

SetCollisionGroupIndex(integer index)

Parameters

SetCollisionList(Libraries.Game.Collision.CollisionEdge3D list)

Parameters

SetCollisionTransform(Libraries.Game.Collision.PhysicsPosition3D transform)

Parameters

SetCollisionTransform0(Libraries.Game.Collision.PhysicsPosition3D transform)

Parameters

SetDefaultMaximumVolumeDistance(number distance)

This action sets the default maximum volume distance for all newly created Audio objects. It will not change the maximum volume distance of any Audio objects that have already been loaded.

Example Code

use Libraries.Sound.Audio

    Audio audio1
    Audio audio2

    // We test to see what the default maximum volume distance is using audio1.
    output "The default rolloff rate is " + audio1:GetDefaultMaximumVolumeDistance()

    audio2:SetDefaultMaximumVolumeDistance(0.5)

    // Even though we changed the default max volume distance using audio2,
    // we can still see the changed default using audio1.
    output "Now the default rolloff rate is " + audio1:GetDefaultMaximumVolumeDistance()

Parameters

SetDefaultRolloffRate(number rolloff)

This action sets the default rolloff rate of newly loaded Audio objects. It will not change the rolloff rates of any Audio objects which have already been loaded.

Example Code

use Libraries.Sound.Audio

    // We create and load audio1 before changing the default rolloff rate.
    Audio audio1
    audio1:Load("Sample1.wav")
    output "Before changing the default rate, audio1 has a rolloff rate of " + audio1:GetRolloffRate()

    audio1:SetDefaultRolloffRate(0.25)

    // We create and load audio2 after changing the default rolloff rate.
    Audio audio2
    audio2:Load("Sample2.wav")
    output "After changing the default rate, audio1 has a rolloff rate of " + audio1:GetRolloffRate()
    output "audio2 has a rolloff rate of " + audio2:GetRolloffRate()

Parameters

SetDepth(number setDepth)

This action sets the depth the Item.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:SetDepth(210.0)

Parameters

SetDescription(text newDescription)

This action sets the internal description of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetDescription("Used for demo purposes.")

Parameters

SetDimensions(number setWidth, number setHeight, number setDepth)

This action sets the width, height, and depth of the Item3D.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:SetDimensions(50, 200, 35)

Parameters

SetDimensions(Libraries.Compute.Vector3 vector)

This action sets the width, height, and depth of the Item3D.

Example Code

use Libraries.Interface.Item3D
        use Libraries.Compute.Vector3
        Item3D myItem
        Vector3 vector
        vector:Set(50, 200, 35)
        myItem:SetDimensions(vector)

Parameters

SetFade(number fade)

SetFade will change how the sound is played through speakers that have forward and back channels. Values passed to this should always be between -1 and 1. A value of -1 will make the sound play through only the back channel. A value of 1 will play the sound only through the front channel. A value of 0 will play the sound equally through both channels. Using Balance, Fade, Rotation, or X,Y,Z coordinates are all exclusive of each other, and using one will override any others used previously.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We always have to load a sound before use.
    audio:Load("noise.ogg")

    // For this example, we will set the fade with the value 1. This will make
    // the sound play through only the front channel.
    audio:SetFade(1)

    // After we load the file, we can play it with a call to PlayUntilDone().
    audio:PlayUntilDone()

    // Once we're finished with an audio file, we need to let the computer know.
    audio:Dispose()

Parameters

SetFocusable(boolean focus)

The SetFocusable action sets whether or not this Item should be focusable. If the Item is currently focused and made unfocusable, then it will lose focus, and there will be no focused element.

Parameters

SetForce(Libraries.Compute.Vector3 force)

Parameters

SetFriction(number friction)

Parameters

SetHasMoved(boolean flag)

Parameters

SetHeight(number setHeight)

This action sets the height of the Item.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:SetHeight(210.0)

Parameters

SetInputGroup(text group)

This action sets the input group for this Item. When used with the Game libraries, this tag describes what InputTable (if any) can interact with this Item due to input.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetInputGroup("arrowKeys")
        output "My item's input group is : " + item:GetInputGroup()

Parameters

SetInterpolatedAngularVelocity(Libraries.Compute.Vector3 velocity)

Parameters

SetInterpolatedLinearVelocity(Libraries.Compute.Vector3 velocity)

Parameters

SetInterpolationTransform(Libraries.Game.Collision.PhysicsPosition3D transform)

Parameters

SetItem(integer index, Libraries.Interface.Item3D newItem)

This action sets a value inside the internal item array of this Item3D.

Example Code

use Libraries.Interface.Item3D

        Item3D parentItem
        Item3D child1
        Item3D child2
        parentItem:Add(child1)
        parentItem:SetItem(0, child2)

Parameters

SetJointList(Libraries.Game.Physics.Joints.JointEdge3D list)

Parameters

SetLayer(Libraries.Game.Layer3D parentLayer)

This action is used by the Game libraries to create a reference to the layer that this Item3D exists on. It is automatically called as needed by the Layer3D class. Most users will never need to use this action directly.

Parameters

SetLinearDamping(number linearDamping)

Parameters

SetLinearVelocity(Libraries.Compute.Vector3 linearVelocity)

Parameters

SetLinearVelocityX(number linearVelocityX)

Parameters

SetLinearVelocityY(number linearVelocityY)

Parameters

SetLinearVelocityZ(number linearVelocityZ)

Parameters

SetListenerDirection(number x, number y, number z)

SetListenerDirection sets the direction the listener is facing in virtual 3D space. This will affect which direction audio seems to come through speakers or headphones when listening to 3D audio.

Example Code

use Libraries.Sound.Audio

        // We load an audio object and set its position to 1 meter in front of the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 0, 1)

        // Now we set the listener to face the right by calling SetListenerDirection.
        // We can do this using any Audio object - it won't affect the result.
        audio:SetListenerDirection(1, 0, 0)

        // The audio is now located to the left of the listener's "ears", so when we
        // play it, it should play through the left speaker.
        audio:PlayUntilDone()

Parameters

SetListenerDirection(Libraries.Compute.Vector3 direction)

SetListenerDirection sets the direction the listener is facing in virtual 3D space. This will affect which direction audio seems to come through speakers or headphones when listening to 3D audio.

Example Code

use Libraries.Sound.Audio
        use Libraries.Compute.Vector3

        // We load an audio object and set its position to 1 meter in front of the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 0, 1)

        // Now we set the listener to face the right by calling SetListenerDirection.
        // We can do this using any Audio object - it won't affect the result.
        Vector3 direction
        direction:Set(1, 0, 0)
        audio:SetListenerDirection(direction)

        // The audio is now located to the left of the listener's "ears", so when we
        // play it, it should play through the left speaker.
        audio:PlayUntilDone()

Parameters

SetListenerPosition(number x, number y, number z)

SetListenerPosition sets the X, Y, and Z coordinates of the listener in 3D space. When audio is played, how it sounds to the user is dependent on both the position of the audio and where the listener is positioned. The listener's position is universal to all audio - or in other words, if you change the position of the listener for one audio object, it adjusts the position of the listener for ALL audio objects.

Example Code

use Libraries.Sound.Audio

        // In this example, we will use two audio objects. 
        Audio buzzer
        buzzer:Load("Buzzer.wav")
        Audio bell
        bell:Load("Bell.ogg")

        // We will now set the listener's position. Although we can set all 3
        // coordinates with this action, we will set just the x-coordinate for
        // this example. This is the same as using SetListenerX(3)
        buzzer:SetListenerPosition(3, 0, 0)

        // Now when we play our audio, both sounds should come from the left
        // side in 3D space - this is because both sounds are at their default
        // location of 0, 0, 0, but the listener is 3 units to the right.
        buzzer:PlayUntilDone()
        bell:PlayUntilDone()

Parameters

SetListenerPosition(Libraries.Compute.Vector3 vector)

SetListenerPosition sets the X, Y, and Z coordinates of the listener in 3D space. When audio is played, how it sounds to the user is dependent on both the position of the audio and where the listener is positioned. The listener's position is universal to all audio - or in other words, if you change the position of the listener for one audio object, it adjusts the position of the listener for ALL audio objects.

Example Code

use Libraries.Sound.Audio
        use Libraries.Compute.Vector3

        // In this example, we will use two audio objects. 
        Audio buzzer
        buzzer:Load("Buzzer.wav")
        Audio bell
        bell:Load("Bell.ogg")

        // We will now set the listener's position. Although we can set all 3
        // coordinates with this action, we will set just the x-coordinate for
        // this example. This is the same as using SetListenerX(3)
        Vector3 vector
        vector:Set(3, 0, 0)
        buzzer:SetListenerPosition(vector)

        // Now when we play our audio, both sounds should come from the left
        // side in 3D space - this is because both sounds are at their default
        // location of 0, 0, 0, but the listener is 3 units to the right.
        buzzer:PlayUntilDone()
        bell:PlayUntilDone()

Parameters

SetListenerUp(number x, number y, number z)

SetListenerUp sets the direction which is considered to be directly "up" from the listener. This should always be perpendicular to the direction that the listener is facing. This is used in combination with the listener direction to determine how audio should be played through the user's speakers or headphones.

Example Code

use Libraries.Sound.Audio

        // We load an audio object and set its position to 1 meter above the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 1, 0)

        // The listener's default direction is straight forward, with the "up" direction
        // being along the positive y-axis. For this example, we'll set the "up"
        // direction to be along the negative x-axis. This effectively means the
        // listener is lying on their left side, with their left ear pointed towards the
        // ground and their right ear pointed up towards the sky.
        // We can do this using any Audio object - it won't affect the result.
        audio:SetListenerUp(-1, 0, 0)

        // Although the sound is located above the listener, since the listener has
        // their right ear pointed upwards, the audio will play through the right speaker.
        audio:PlayUntilDone()

Parameters

SetListenerUp(Libraries.Compute.Vector3 up)

SetListenerUp sets the direction which is considered to be directly "up" from the listener. This should always be perpendicular to the direction that the listener is facing. This is used in combination with the listener direction to determine how audio should be played through the user's speakers or headphones.

Example Code

use Libraries.Sound.Audio
        use Libraries.Compute.Vector3

        // We load an audio object and set its position to 1 meter above the
        // default listener position.
        Audio audio
        audio:Load("Chime.wav")
        audio:SetPosition(0, 1, 0)

        // The listener's default direction is straight forward, with the "up" direction
        // being along the positive y-axis. For this example, we'll set the "up"
        // direction to be along the negative x-axis. This effectively means the
        // listener is lying on their left side, with their left ear pointed towards the
        // ground and their right ear pointed up towards the sky.
        // We can do this using any Audio object - it won't affect the result.
        Vector3 up
        up:Set(-1, 0, 0)
        audio:SetListenerUp(up)

        // Although the sound is located above the listener, since the listener has
        // their right ear pointed upwards, the audio will play through the right speaker.
        audio:PlayUntilDone()

Parameters

SetListenerVelocity(Libraries.Compute.Vector3 vector)

SetListenerVelocity will set the listener's velocity in 3D space. Just like individual objects, the listener can have velocity, which will be used during calculation of doppler shift. The listener is universal to all audio objects, which means that setting the listener in one audio object will set it for ALL audio objects. The velocity is measured as meters per second.

Example Code

use Libraries.Sound.Audio
        use Libraries.Compute.Vector3

        Audio flute
        flute:Load("Flute.ogg")

        Vector3 vector
        vector:Set(15, 8, 11)
        
        // The listener is given a velocity of 15 meters per second along the
        // x-axis, 8 meters per second along the y-axis, and 11 meters-per-second
        // along the z-axis.
        flute:SetListenerVelocity(vector)

Parameters

SetListenerVelocity(number x, number y, number z)

SetListenerVelocity will set the listener's velocity in 3D space. Just like individual objects, the listener can have velocity, which will be used during calculation of doppler shift. The listener is universal to all audio objects, which means that setting the listener in one audio object will set it for ALL audio objects. The velocity is measured as meters per second.

Example Code

use Libraries.Sound.Audio

        Audio flute
        flute:Load("Flute.ogg")
        
        // The listener is given a velocity of 15 meters per second along the
        // x-axis, 8 meters per second along the y-axis, and 11 meters-per-second
        // along the z-axis.
        flute:SetListenerVelocity(15, 8, 11)

Parameters

SetListenerVelocityX(number x)

SetListenerVelocityX will set the listener's velocity along the x-axis. Just like individual objects, the listener can have velocity, which will be used during calculation of doppler shift. The listener is universal to all audio objects, which means that setting the listener in one audio object will set it for ALL audio objects. The velocity is measured as meters per second.

Example Code

use Libraries.Sound.Audio

        Audio flute
        flute:Load("Flute.ogg")
        
        // The listener is given a velocity of 15 meters per second along the
        // x-axis.
        flute:SetListenerVelocityX(15)

Parameters

SetListenerVelocityY(number x)

SetListenerVelocityY will set the listener's velocity along the y-axis. Just like individual objects, the listener can have velocity, which will be used during calculation of doppler shift. The listener is universal to all audio objects, which means that setting the listener in one audio object will set it for ALL audio objects. The velocity is measured as meters per second.

Example Code

use Libraries.Sound.Audio

        Audio flute
        flute:Load("Flute.ogg")
        
        // The listener is given a velocity of 8 meters per second along the
        // y-axis.
        flute:SetListenerVelocityY(8)

Parameters

SetListenerVelocityZ(number z)

SetListenerVelocityZ will set the listener's velocity along the z-axis. Just like individual objects, the listener can have velocity, which will be used during calculation of doppler shift. The listener is universal to all audio objects, which means that setting the listener in one audio object will set it for ALL audio objects. The velocity is measured as meters per second.

Example Code

use Libraries.Sound.Audio

        Audio flute
        flute:Load("Flute.ogg")
        
        // The listener is given a velocity of 11 meters per second along the
        // z-axis.
        flute:SetListenerVelocityZ(11)

Parameters

SetListenerX(number x)

SetListenerX sets the x-coordinate of the listener in 3D space. When audio is played, how it sounds to the user is dependent on both the position of the audio and where the listener is positioned. The listener's position is universal to all audio - or in other words, if you change the position of the listener for one audio object, it adjusts the position of the listener for ALL audio objects.

Example Code

use Libraries.Sound.Audio

        // In this example, we will use two audio objects. 
        Audio buzzer
        buzzer:Load("Buzzer.wav")
        Audio bell
        bell:Load("Bell.ogg")

        // We will now set the listener's x position. We could do this with
        // either of our audio objects.
        buzzer:SetListenerX(3)

        // Now when we play our audio, both sounds should come from the left
        // side in 3D space - this is because both sounds are at their default
        // location of 0, 0, 0, but the listener is 3 units to the right.
        buzzer:PlayUntilDone()
        bell:PlayUntilDone()

Parameters

SetListenerY(number y)

SetListenerY sets the y-coordinate of the listener in 3D space. When audio is played, how it sounds to the user is dependent on both the position of the audio and where the listener is positioned. The listener's position is universal to all audio - or in other words, if you change the position of the listener for one audio object, it adjusts the position of the listener for ALL audio objects.

Example Code

use Libraries.Sound.Audio

        // In this example, we will use two audio objects. 
        Audio buzzer
        buzzer:Load("Buzzer.wav")
        Audio bell
        bell:Load("Bell.ogg")

        // We will now set the listener's x position. We could do this with
        // either of our audio objects.
        buzzer:SetListenerY(3)

        // Now when we play our audio, both sounds are affected by the new
        // position of the listener.
        buzzer:PlayUntilDone()
        bell:PlayUntilDone()

Parameters

SetListenerZ(number z)

SetListenerZ sets the z-coordinate of the listener in 3D space. When audio is played, how it sounds to the user is dependent on both the position of the audio and where the listener is positioned. The listener's position is universal to all audio - or in other words, if you change the position of the listener for one audio object, it adjusts the position of the listener for ALL audio objects.

Example Code

use Libraries.Sound.Audio

        // In this example, we will use two audio objects. 
        Audio buzzer
        buzzer:Load("Buzzer.wav")
        Audio bell
        bell:Load("Bell.ogg")

        // We will now set the listener's x position. We could do this with
        // either of our audio objects.
        buzzer:SetListenerZ(3)

        // Now when we play our audio, both sounds are affected by the new
        // position of the listener.
        buzzer:PlayUntilDone()
        bell:PlayUntilDone()

Parameters

SetMass(number mass)

Parameters

SetMaximumVolumeDistance(number distance)

The SetMaximumVolumeDistance action will determine how far the sound can be from the listener before the volume is adjusted due to distance attenuation. If the audio listener is within the maximum volume distance of the audio, the audio will play at full volume. If the listener is farther away than this distance, then distance attenuation is applied relative to how much farther the listener is than this distance. When a new Audio object is created, its maximum volume distance is equal to the current default distance, which begins as 1.0 and can be set by calling SetDefaultMaximumVolumeDistance().

Example Code

use Libraries.Sound.Audio

    Audio audio
    audio:Load("Chime.wav")
    // The Audio is placed 10 units away to the right of the listener.
    audio:SetX(10)
    // The Audio is played using its default maximum volume distance of 1 unit.
    audio:PlayUntilDone()
    // Now we set the maximum volume distance to 15 units. Since the listener is
    // within 15 units of the sound, it will play at maximum volume.
    audio:SetMaximumVolumeDistance(15)
    audio:PlayUntilDone()

Parameters

SetName(text newName)

This action sets the internal name of the Item.

Example Code

use Libraries.Interface.Item

        Item item
        item:SetName("My Item")

Parameters

SetNextFocus(Libraries.Interface.Item next)

This action sets the next focus item. When this Item has the focus and the user requests the focus to advance (e.g. by pressing the tab key), the focus will move to the next focus item, if it is defined.

Parameters

SetNonResponsive()

SetOffset(Libraries.Compute.Vector3 vector)

This action sets the offsets of the item. The offsets tell the Item where to relate its position to. In other words, the offsets determine where each coordinate of 0 is for this item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Game.Audio3D
        use Libraries.Compute.Vector3
        Audio3D sound
        Vector3 vector
        vector:Set(75, 40, 35)
        sound:SetOffset(vector)

Parameters

SetOffset(number offsetX, number offsetY, number offsetZ)

This action sets the offsets of the Item. The offsets tell the Item where to relate its position to. In other words, the offsets determine where each coordinate of 0 is for this item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Game.Audio3D
        Audio3D sound
        sound:SetOffset(75, 40, 35)

Parameters

SetOffsetX(number offsetX)

This action sets the X offset of the Item. The offset tells the Item where to relate its X position to. In other words, the X offset is where an X coordinate of 0 is for this Item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Game.Audio3D
        Audio3D sound
        sound:SetOffsetX(100)

Parameters

SetOffsetY(number offsetY)

This action sets the Y offset of the Item. The offset tells the Item where to relate its Y position to. In other words, the Y offset is where a Y coordinate of 0 is for this item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Game.Audio3D
        Audio3D sound
        sound:SetOffsetY(75)

Parameters

SetOffsetZ(number offsetZ)

This action sets the Z offset of the Item. The offset tells the Item where to relate its Z position to. In other words, the Z offset is where a Z coordinate of 0 is for this item. This is automatically set when using an action to add an Item to another Item.

Example Code

use Libraries.Game.Audio3D
        Audio3D sound
        sound:SetOffsetZ(75)

Parameters

SetParent(Libraries.Interface.Item3D newItem)

This action sets a reference to the parent item. It is called automatically when an Item3D is added as a child to another Item3D. Most users will not need to use this action directly.

Parameters

SetPhysicsProperties(Libraries.Game.Physics.PhysicsProperties3D properties)

Parameters

SetPitch(number pitch)

The SetPitch action sets the pitch of the sound. By default, sounds have a pitch value of 1.0 (or 100% normal pitch). Lower values reduce the pitch, while higher values increase the pitch. Changing the pitch also causes the audio to play slower (with low pitch) or faster (with high pitch).

Example Code

use Libraries.Sound.Audio

    Audio audio
    audio:Load("Chime.wav")
    // We will play the sound at 75% of its normal pitch.
    audio:SetPitch(0.75)
    audio:PlayUntilDone()

Parameters

SetPosition(Libraries.Compute.Vector3 vector)

SetPosition will set the X, Y, and Z coordinates of the Audio3D in 3D space.

Example Code

use Libraries.Game.Audio3D
        use Libraries.Compute.Vector3
        Audio3D sound
        Vector3 vector
        vector:Set(50, 200, 35)
        sound:SetPosition(vector)

Parameters

SetPosition(number x, number y, number z)

SetPosition will set the X, Y, and Z coordinates of the Audio3D in 3D space.

Example Code

use Libraries.Game.Audio3D

        Audio3D sound
        sound:SetPosition(50, 200, 35)

Parameters

SetPreviousFocus(Libraries.Interface.Item previous)

This action sets the previous focus item. When this Item has the focus and the user requests the focus to move backwards (e.g. by pressing shift & tab), the focus will move to the previous focus item, if it is defined.

Parameters

SetResponsive()

SetResponsiveness(integer type)

Parameters

SetRestitution(number restitution)

Parameters

SetRolloffRate(number rolloff)

The SetRolloffRate action sets the rate at which 3D positional audio becomes quieter when positioned far away from the listener. When an Audio object is created, its rolloff rate is equal to the default value provided by GetDefaultRolloffRate, which begins at 1.0 (but may be changed by the user). Lower rolloff rates cause the sound to fade more slowly over long distances, and higher rolloff rates cause sound to fade more quickly. The rolloff value must always be positive.

Example Code

use Libraries.Sound.Audio

    Audio audio
    audio:Load("Chime.wav")
    // We will play the Audio using the default rolloff factor of 1.0, first at
    // 1 unit away from the listener, then at 5 units away from the listener.
    audio:SetX(1)
    audio:PlayUntilDone()
    audio:SetX(5)
    audio:PlayUntilDone()
    // Now we set rolloff factor to 0.25, which will make the volume decrease 4
    // times slower than the previous value of 1, and we play the Audio again.
    // It should be the same volume when close (e.g. at 1 unit) but noticeably 
    // louder than it was previously when it is far away (e.g. at 5 units)
    audio:SetRolloffRate(0.25)
    audio:SetX(1)
    audio:PlayUntilDone()
    audio:SetX(5)
    audio:PlayUntilDone()

Parameters

SetRotation(number rotation)

SetRotation sets a sound to play at a point in 3D space such that it has constant volume and is located a given number of degrees from the listener, where 0 degrees is directly in front of the listener and the sound rotates clockwise around the listener. Using Balance, Fade, Rotation, or X,Y,Z coordinates are all exclusive of each other, and using one will override any others used previously.

Example Code

use Libraries.Sound.Audio

        // To use audio, we'll first need to create an object for it.
        Audio audio

        // We always have to load a sound before use.
        audio:Load("noise.ogg")

        // For this example, we will rotate the sound so it is to the right of
        // the listener.
        audio:SetRotation(90)

        // After we load the file, we can play it with a call to PlayUntilDone().
        audio:PlayUntilDone()

        // Once we're finished with an audio file, we need to let the computer know.
        audio:Dispose()

Parameters

SetScreenPositionFromPhysicsPosition()

SetShape(Libraries.Game.Collision.Shapes.CollisionShape3D shape)

We store the offsets we'll be using before manipulating anything. This ensures we use the original data, and there's no risk of using data that's been modified on the fly (e.g., updating a parent item will affect the position of the child item).

Parameters

SetSleepTime(number time)

Parameters

SetTimeOfImpact(number timeOfImpact)

Parameters

SetTorque(Libraries.Compute.Vector3 torque)

Parameters

SetUnmovable()

SetVelocity(number x, number y, number z)

SetVelocity will set the velocity of the audio in 3D space along the X, Y, and Z axes. The velocity is measured in meters per seconds, and is used to calculate doppler effects. If doppler is disabled, then the audio's velocity is ignored. Note that setting the velocity of audio will NOT automatically update the position of the audio over time!

Example Code

use Libraries.Sound.Audio

        // To use audio, we need to create an object for it first.
        Audio audio
        
        // We always have to load a sound before use.
        audio:Load("Car.wav")

        // Now we set the velocity of our audio. All numbers are measured in
        // meters per second.
        audio:SetVelocity(20, 5, 8)

Parameters

SetVelocity(Libraries.Compute.Vector3 velocity)

SetVelocity will set the velocity of the audio in 3D space along the X, Y, and Z axes. The velocity is measured in meters per seconds, and is used to calculate doppler effects. If doppler is disabled, then the audio's velocity is ignored. Note that setting the velocity of audio will NOT automatically update the position of the audio over time!

Example Code

use Libraries.Sound.Audio
        use Libraries.Compute.Vector3

        // To use audio, we need to create an object for it first.
        Audio audio

        // In this example, we will set the velocity using a Vector3 object.
        Vector3 velocity
        
        // We always have to load a sound before use.
        audio:Load("Car.wav")

        // We can now set our vector with our velocity. All numbers are measured
        // in meters per second.
        velocity:Set(20, 5, 8)

        // Now we set the velocity of our audio using our vector.
        audio:SetVelocity(velocity)

Parameters

SetVelocityX(number x)

SetVelocityX will set the velocity of the audio along the x-axis in 3D space. The velocity is measured in meters per seconds, and is used to calculate doppler effects. If doppler is disabled, then the audio's velocity is ignored. Note that setting the velocity of audio will NOT automatically update the position of the audio over time!

Example Code

use Libraries.Sound.Audio

        // To use audio, we need to create an object for it first.
        Audio audio
        
        // We always have to load a sound before use.
        audio:Load("Car.wav")

        // For this example, we will make the sound move 20 meters per second
        // to the left.
        audio:SetVelocityX(20)

Parameters

SetVelocityY(number y)

SetVelocityY will set the velocity of the audio along the y-axis in 3D space. The velocity is measured in meters per seconds, and is used to calculate doppler effects. If doppler is disabled, then the audio's velocity is ignored. Note that setting the velocity of audio will NOT automatically update the position of the audio over time!

Example Code

use Libraries.Sound.Audio

        // To use audio, we need to create an object for it first.
        Audio audio
        
        // We always have to load a sound before use.
        audio:Load("Car.wav")

        // For this example, we will make the sound move 20 meters per second
        // along the y-axis.
        audio:SetVelocityY(20)

Parameters

SetVelocityZ(number z)

SetVelocityZ will set the velocity of the audio along the z-axis in 3D space. The velocity is measured in meters per seconds, and is used to calculate doppler effects. If doppler is disabled, then the audio's velocity is ignored. Note that setting the velocity of audio will NOT automatically update the position of the audio over time!

Example Code

use Libraries.Sound.Audio

        // To use audio, we need to create an object for it first.
        Audio audio
        
        // We always have to load a sound before use.
        audio:Load("Car.wav")

        // For this example, we will make the sound move 20 meters per second
        // along the z-axis.
        audio:SetVelocityZ(20)

Parameters

SetVolume(number volume)

The SetVolume action adjusts the volume of a sound. It takes a number value to set the volume to a percentage of the original sound volume. A value of 1.0 will play the sound at 100% of standard volume. To reduce the sound by 25%, for example, you would provide the number 0.75, or 75% volume.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We always have to load a sound before use.
    audio:Load("ding.wav")

    // For this example, we will set the audio to 50%, or half, volume.
    audio:SetVolume(0.5)

    // After we load the file, we can play it with a call to PlayUntilDone().
    audio:PlayUntilDone()

    // Once we're finished with an audio file, we need to let the computer know.
    audio:Dispose()

Parameters

SetWidth(number setWidth)

This action sets the width of the Item.

Example Code

use Libraries.Interface.Item3D
        Item3D myItem
        myItem:SetWidth(35.0)

Parameters

SetX(number x)

SetX will set the X coordinate of the Audio3D in 3D space.

Example Code

use Libraries.Game.Audio3D
        Audio3D sound
        sound:SetX(35.0)

Parameters

SetY(number y)

SetY will set the Y coordinate of the Audio3D in 3D space.

Example Code

use Libraries.Game.Audio3D
        Audio3D sound
        sound:SetY(35.0)

Parameters

SetZ(number z)

SetZ will set the Z coordinate of the Audio3D in 3D space.

Example Code

use Libraries.Game.Audio3D
        Audio3D sound
        sound:SetZ(35.0)

Parameters

ShouldCollide(Libraries.Interface.Item3D otherItem)

Parameters

Return

boolean

Show()

This action is used to indicate that an Item and all Items that were added to it should be visible on the screen. Note that the Item class on its own cannot be drawn on the screen, but classes that inherit from it such as Libraries.Game.Graphics.Drawable can be. By default, Items are considered visible.

Example Code

use Libraries.Interface.Item

        Item item
        item:Show()

Simulate(boolean flag)

Parameters

Stop()

The Stop action will stop audio if it is currently playing. If it is not playing, it will do nothing.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // We always have to load a sound before use.
    audio:Load("ding.wav")

    // After we load the file, we can play it with a call to Play().
    audio:Play()

    // Now that audio is playing, we can stop it at any time by calling Stop().
    audio:Stop()

Stream()

The Stream action is used to load and play the next chunk of data for a file that was prepared using LoadToStream. To play an audio file smoothly this way, Stream should be called in a loop. When the entire audio file has been played, if looping is disabled it will stop playing. If looping is enabled, it will continue playing.

Example Code

use Libraries.Sound.Audio

    // To use audio, we'll first need to create an object for it.
    Audio audio

    // In this example, we'll load a file called "LongSong.ogg" from a folder 
    // called "Sounds" in our project.
    // Since our audio file is large, it makes sense to load it for streaming.
    audio:LoadToStream("Sounds/LongSong.ogg")

    // After we load the file, we can begin playing it with Play(). This will
    // play the first "chunk" of data we loaded from the stream.
    audio:Play()

    // To play the whole song, we will need to keep loading chunks of data until
    // the song is finished. To do this, we will use the repeat structure.

    // This will continuously call our code until we have played the whole song.
    repeat while audio:IsPlaying()
        // This will load and play the next chunk of sound data.
        audio:Stream()
    end

SynchronizeNodes()

transform:Scale(vecto

Update(number seconds)

This action will update the Audio3D, ensuring that its velocity is calculated for use in Doppler shift simulation (if it is enabled). Classes that override the Update action should make sure to call the parent action!

Parameters

UpdateAll(number secondsSinceUpdate)

This action calls the Update action on this Item and all Items that have been added to this item with the Add action.

Example Code

use Libraries.Interface.Item
        
        Item parentItem
        Item child1
        Item child2
        parentItem:Add(child1)
        parentItem:Add(child2)
        parentItem:UpdateAll(0)

Parameters

UpdateInertia()