Libraries.Interface.Controls.Scenes.Items.EditorModel Documentation
The EditorModel class represents a 3D item that is being edited in the SceneEditor. Other than representing a 3D model to be drawn on the screen, this class contains helper functions that allow for setting the rotation of the 3D object from a set of 3 angles. As well as setting and resetting the scale of the object.
Inherits from: Libraries.Interface.Item3D, Libraries.Interface.Item, Libraries.Language.Object, Libraries.Game.Graphics.Model
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.
Parameters
- Libraries.Interface.Item3D: The item to add as a child to this Item3D.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child
parentItem:Add(child)
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.
Parameters
- integer index: The index to store the child item at.
- Libraries.Interface.Item3D: The item to add as a child to this Item3D.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child
parentItem:Add(0, child)
AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.FocusListener
Item myItem
FocusListener listener
myItem:AddFocusListener(listener)
AddGestureListener(Libraries.Interface.Events.GestureListener listener)
This action adds a GestureListener to the Item. If the Item ever receives a GestureEvent, the listener will be notified.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.GestureListener
Item myItem
GestureListener listener
myItem:AddGestureListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseListener
Item myItem
MouseListener listener
myItem:AddMouseListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseMovementListener
Item myItem
MouseMovementListener listener
myItem:AddMouseMovementListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseWheelListener
Item myItem
MouseWheelListener listener
myItem:AddMouseWheelListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.TouchListener
Item myItem
TouchListener listener
myItem:AddTouchListener(listener)
ApplyAngularImpulse(Libraries.Compute.Vector3 impulse)
This action will increase the y-coordinate of this Item by the given amount.
Parameters
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetY(50)
myItem:MoveY(25)
ApplyDamping(number seconds)
Parameters
- number seconds
ApplyForce(Libraries.Compute.Vector3 force, Libraries.Compute.Vector3 point)
transform:Translate(xAmount, yAmount, -zAmount)
Parameters
ApplyForceToCenter(Libraries.Compute.Vector3 force)
This action will increase the x, y, and z coordinates of this Item by the given amounts.
Parameters
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetPosition(50, 25, 80)
myItem:Move(25, 15, -20)
ApplyImpulse(Libraries.Compute.Vector3 impulse, Libraries.Compute.Vector3 localPositionToApply)
ApplyLinearImpulse(Libraries.Compute.Vector3 impulse, Libraries.Compute.Vector3 point)
This action will increase the z-coordinate of this Item by the given amount.
Parameters
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetZ(50)
myItem:MoveZ(25)
ApplyLinearImpulseToCenter(Libraries.Compute.Vector3 impulse)
ApplyTorque(Libraries.Compute.Vector3 torque)
ApplyTorqueImpulse(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.
Parameters
- Libraries.Interface.Item: The other Item involved in the collision.
Example
use Libraries.Interface.Item
Item collider1
Item collider2
collider1:BeginCollision(collider2)
collider2:BeginCollision(collider1)
CalculateBoundingBox()
CalculateBoundingBox will create a new BoundingBox object that contains the bounds of the Model.
Return
Libraries.Game.BoundingBox: A new axis-aligned BoundingBox for this Model.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
use Libraries.Game.BoundingBox
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
Color mint
mint:SetColor(0.5, 1, 0.75, 1)
cube:LoadBox(2, 2, 2, mint)
Add(cube)
BoundingBox box = cube:CalculateBoundingBox()
output "The dimensions of the bounding box are: " + box:GetWidth() + ", " + box:GetHeight() + ", " + box:GetDepth()
end
end
CalculateBoundingBox(Libraries.Game.BoundingBox box)
CalculateBoundingBox will compute the bounds of this Model, and then store them inside the provided BoundingBox object. If any data was previously stored in this BoundingBox, it will be overwritten.
Parameters
Return
Libraries.Game.BoundingBox: The given axis-aligned BoundingBox, which will contain the bounds of this Model.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
use Libraries.Game.BoundingBox
class Main is Game
Model cube
BoundingBox box
action Main
StartGame()
end
action CreateGame
Color mint
mint:SetColor(0.5, 1, 0.75, 1)
cube:LoadBox(2, 2, 2, mint)
Add(cube)
cube:CalculateBoundingBox(box)
output "The dimensions of the bounding box are: " + box:GetWidth() + ", " + box:GetHeight() + ", " + box:GetDepth()
end
end
CanRotate(boolean flag)
Parameters
- boolean flag
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 an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Example
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
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)
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.
Parameters
Example
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)
DestroyNodes(Libraries.Game.Collision.BroadphaseCollision3D broadphase)
This action will remove all Items from this Item's children hierarchy. Note that this will not empty the hierarchies of the contained Items.
Parameters
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child1
Item3D child2
Item3D grandchild
parentItem:Add(child1)
parentItem:Add(child2)
child1:Add(grandChild)
parentItem:Empty()
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)
The Draw action is what makes a Model appear on the screen. This action will automatically be called by the Game class if the Model has been added to the Game with the Add(Item) action. Most users will never need to use this action directly.
Parameters
- Libraries.Game.Graphics.Painter3D: The Painter3D being used to draw this Model.
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
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.
EnablePhysics(boolean flag)
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).
Parameters
- boolean flag
Example
use Libraries.Interface.Item3D
Item3D myItem
Item3D parentItem
parentItem:SetY(50)
myItem:SetY(25)
parentItem:Add(myItem)
number y = myItem:GetGlobalY()
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
Example
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
ExtendBoundingBox(Libraries.Game.BoundingBox box)
ExtendBoundingBox will expand the bounds of the given BoundingBox to fully encapsulate the bounds of this Model.
Parameters
- Libraries.Game.BoundingBox: The BoundingBox to extend.
Return
Libraries.Game.BoundingBox: The given BoundingBox, which now includes the bounds of this Model.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
use Libraries.Game.BoundingBox
class Main is Game
Model cube
Model cylinder
action Main
StartGame()
end
action CreateGame
Color blue
blue:SetColor(0, 0, 1, 1)
cube:LoadBox(2, 2, 2, blue)
Add(cube)
cylinder:LoadCylinder(1, 4, 1, blue)
Add(cylinder)
BoundingBox box = cube:CalculateBoundingBox()
cylinder:ExtendBoundingBox(box)
output "The dimensions of the bounding box are: " + box:GetWidth() + ", " + box:GetHeight() + ", " + box:GetDepth()
end
end
FastMoving(boolean flag)
This action sets the x, y, and z coordinates of the Item3D.
Parameters
- boolean flag
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetPosition(50, 200, 35)
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.
Parameters
- Libraries.Interface.Item: The other Item involved in the collision.
Example
use Libraries.Interface.Item
Item collider1
Item collider2
collider1:FinishCollision(collider2)
collider2:FinishCollision(collider1)
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)
GetAccessibilityCode()
This action returns the current accessiblity code for this Item
Return
integer:
GetAccessibilityRoleDescription()
This action returns the custom accessibility role description for this item, if any.
Return
text:
GetAccessibilityType()
This action returns the name of the accessiblity code for this Item as Text
Return
text:
GetAccessibleParent()
This action returns the parent of this Item3D. An Item3D gets a parent when it is added to another Item using the Add action.
Return
Libraries.Interface.Item: The parent Item.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child
parentItem:Add(child)
Item3D item = child:GetParent()
GetAngularDamping()
This action sets the width, height, and depth of the Item3D.
Return
number:
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetDimensions(50, 200, 35)
GetAngularFactor()
Source: http://answers.unity3d.com/storage/temp/12048-lefthandedtorighthanded.pdf
Return
number:
GetAngularVelocity()
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.
Return
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetZ(75)
GetAnimations()
This action returns an array containing all Animation objects used by this Model.
Return
Libraries.Containers.Array: The array containing the Animations used by this Model.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
use Libraries.Game.Graphics.ModelData.Animation
use Libraries.Containers.Array
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
Color cyan
cyan:SetColor(0, 0.75, 1, 1)
cube:LoadBox(2, 2, 2, cyan)
Add(cube)
Array<Animation> animations = cube:GetAnimations()
output "This model uses " + animations:GetSize() + " animation(s)."
end
end
GetAssetFile()
This action returns the asset file that was used to load this asset. This might be a custom model file (e.g. ".obj") or it might be a texture applied to a primitive (e.g. ".png"). If this model doesn't use an asset file (e.g. it's a non-textured primitive object) then this will remain undefined.
Return
Libraries.System.File: The file that was used to load this Model, or undefined if no such file has been used.
GetBlueprintKey()
This action will return the identifier for the ModelBlueprint that this model was loaded from.
Return
text: A text value identifying the ModelBlueprint used to load this Model.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
Color cyan
cyan:SetColor(0, 0.75, 1, 1)
cube:LoadBox(2, 2, 2, cyan)
Add(cube)
text id = cube:GetBlueprintKey()
output "The cube's ModelBlueprint ID is " + id
end
end
GetBoundingBox(integer childIndex)
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
- integer childIndex
Return
GetCenterOfMassPosition()
GetCenterOfMassTransform()
GetCollisionGroupFlag()
This action lets the 3D collision solver actions (inside the class CollisionSolver3D) know that if this object needs its physics to be updated.
Return
boolean:
GetCollisionGroupIndex()
This action sets where in the "list of objects that needs to be updated because collision happened" that this object resides in. This "list of objects that needs to be updated because collision happened" is stored inside the CollisionSolver3D class as tempSolverBodyPool.
Return
integer:
GetCollisionList()
This action will return the Matrix4 containing the rotations applied to the Item3D. The values inside the Matrix are used during transform calculations, so they shouldn't be changed unless you know what you're doing!
Return
Libraries.Game.Collision.CollisionEdge3D: The Matrix4 used by this item to store and calculate rotations.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Matrix4
Item3D myItem
Matrix4 matrix = myItem:GetRotationTransform()
GetCollisionTransform()
This action removes an Item3D that was previously added to this Item3D.
Return
Libraries.Game.Collision.PhysicsPosition3D: Whether or not the item was found and removed.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child1
Item3D child2
parentItem:Add(child1)
parentItem:Add(child2)
parentItem:Remove(child1)
GetCollisionTransform0()
GetColor()
This action returns the diffuse color of a primitive model. If a primitive shape hasn't been loaded, this action will return undefined.
Return
GetDepth()
GetDepth will return the depth of this Item3D.
Return
number: The depth of this item.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetDepth(50)
number depth = myItem:GetDepth()
GetDescription()
This action returns the current internal description of the Item.
Return
text:
Example
use Libraries.Interface.Item
Item item
item:SetDescription("Used for demo purposes.")
output "My item's description is : " + item:GetDescription()
GetDimensions()
GetDimensions will return a Vector3 object containing the width, height, and depth of this Item3D object.
Return
Libraries.Compute.Vector3: A new Vector3 object containing the width, height, and depth of this item.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
myItem:SetWidth(50)
Vector3 vector = myItem:GetDimensions()
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()
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.
Return
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetX(100)
GetFriction()
GetZ will return the Z coordinate of this Item3D in 3D space. Note that if if this object 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.
Return
number: The current z coordinate of this Item, relative to the parent Item (if there is one).
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetZ(50)
number z = myItem:GetZ()
GetGestureListeners()
This action returns an Iterator containing all of the GestureListeners that have been added to this Item using the AddGestureListener action.
Return
Libraries.Containers.Iterator: An iterator containing all of the registered GestureListeners.
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).
Return
Libraries.Compute.Vector3: A new Vector3 object containing the global coordinates of this Item (not relative to any parent).
Example
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()
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).
Return
number: The global X coordinate of this Item (not relative to any parent).
Example
use Libraries.Interface.Item3D
Item3D myItem
Item3D parentItem
parentItem:SetX(50)
myItem:SetX(25)
parentItem:Add(myItem)
number x = myItem:GetGlobalX()
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).
Return
number: The global Y coordinate of this Item (not relative to any parent).
Example
use Libraries.Interface.Item3D
Item3D myItem
Item3D parentItem
parentItem:SetY(50)
myItem:SetY(25)
parentItem:Add(myItem)
number y = myItem:GetGlobalY()
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).
Return
number: The global Z coordinate of this Item (not relative to any parent).
Example
use Libraries.Interface.Item3D
Item3D myItem
Item3D parentItem
parentItem:SetZ(50)
myItem:SetZ(25)
parentItem:Add(myItem)
number z = myItem:GetGlobalZ()
GetHashCode()
This action gets the hash code for an object.
Return
integer: The integer hash code of the object.
Example
Object o
integer hash = o:GetHashCode()
GetHeight()
GetHeight will return the height of this Item3D.
Return
number: The height of this item.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetHeight(50)
number height = myItem:GetHeight()
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.
Return
text: The input group tag being used by this Item.
Example
use Libraries.Interface.Item
Item item
item:SetInputGroup("arrowKeys")
output "My item's input group is : " + item:GetInputGroup()
GetInputTable()
Return
GetInterpolatedAngularVelocity()
GetInterpolatedLinearVelocity()
GetInterpolationTransform()
This action adds a different Item3D into this one, storing the added Item3D at a specific index in the internal array.
Return
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child
parentItem:Add(0, child)
GetInterpolationWorldTransform()
GetInverseInertiaLocal()
GetInverseInertiaWorld()
GetHeight will return the height of this Item3D.
Return
Libraries.Compute.Matrix3: The height of this item.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetHeight(50)
number height = myItem:GetHeight()
GetInverseMass()
GetDepth will return the depth of this Item3D.
Return
number: The depth of this item.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetDepth(50)
number depth = myItem:GetDepth()
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.
Parameters
- integer index: The index to retrieve from the children array.
Return
Libraries.Interface.Item3D: The child Item stored at the index.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child1
Item3D child2
parentItem:Add(child1)
parentItem:Add(child2)
Item3D temp = parentItem:GetItem(0)
GetItemCount()
This action returns the number of items contained in this Item3D.
Return
integer: The number of children in this Item3D.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child1
Item3D child2
parentItem:Add(child1)
parentItem:Add(child2)
integer size = parentItem:GetItemCount()
GetItems()
This action returns an iterator containing all the items contained in this Item3D.
Return
Libraries.Containers.Iterator: An iterator containing all children in this Item3D.
Example
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()
GetJointList()
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.
Parameters
Example
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)
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.
Return
Libraries.Containers.Array: An array of all Lights stored in this Item3D.
Example
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()
GetLinearDamping()
GetWidth will return the width of this Item3D.
Return
number: The width of this item.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetWidth(50)
number width = myItem:GetWidth()
GetLinearVelocity()
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.
Return
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(75, 40, 35)
myItem:SetOffset(vector)
GetLinearVelocityAtLocalPoint(Libraries.Compute.Vector3 relativePosition)
GetMass()
This action will increase the x-coordinate of this Item by the given amount.
Return
number:
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetX(50)
myItem:MoveX(25)
GetMaterials()
This action returns an array containing all Material objects used by this Model.
Return
Libraries.Containers.Array: The array containing the Materials used by this Model.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
use Libraries.Game.Graphics.Material
use Libraries.Containers.Array
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
Color cyan
cyan:SetColor(0, 0.75, 1, 1)
cube:LoadBox(2, 2, 2, cyan)
Add(cube)
Array<Material> materials = cube:GetMaterials()
output "This model uses " + materials:GetSize() + " material(s)."
end
end
GetModelBlueprint()
This action will return the ModelBlueprint that this model was loaded from.
Return
Libraries.Game.Graphics.ModelBlueprint: The ModelBlueprint that this Model was loaded from.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
use Libraries.Game.Graphics.ModelBlueprint
class Main is Game
Model cube
ModelBlueprint schematic = undefined
action Main
StartGame()
end
action CreateGame
Color cyan
cyan:SetColor(0, 0.75, 1, 1)
cube:LoadBox(2, 2, 2, cyan)
Add(cube)
schematic = cube:GetModelBlueprint()
end
end
GetModelType()
This action returns the type of Model that has been loaded using one of the integer codes found in SceneProperties. By default, this value is NONE.
Return
integer: An integer code representing the type of Model that has been loaded.
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.
Return
text:
Example
use Libraries.Interface.Item
Item item
item:SetName("My Item")
output "My item's name is " + item:GetName()
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)
This action returns an iterator containing all the items contained in this Item3D.
Parameters
- integer index
Return
Libraries.Game.Collision.Item3DNode: An iterator containing all children in this Item3D.
Example
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()
GetNodeCount()
This action returns whether or not any items are contained in this Item.
Return
integer: Whether or not this item contains any children.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child1
parentItem:Add(child1)
boolean wasEmpty = parentItem:IsEmpty()
GetNodes()
This action returns an array containing all Node objects used by this Model.
Return
Libraries.Containers.Array: The array containing the Nodes used by this Model.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
use Libraries.Game.Graphics.ModelData.Node
use Libraries.Containers.Array
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
Color cyan
cyan:SetColor(0, 0.75, 1, 1)
cube:LoadBox(2, 2, 2, cyan)
Add(cube)
Array<Node> nodes = cube:GetNodes()
output "This model uses " + nodes:GetSize() + " node(s)."
end
end
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.
Return
number: The current X offset.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetX(100)
number offset = myItem:GetOffsetX()
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.
Return
number: The current Y offset.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetY(75)
number offset = myItem:GetOffsetY()
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.
Return
number: The current Z offset.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetZ(75)
number offset = myItem:GetOffsetZ()
GetOrientation()
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.
Return
Libraries.Interface.Item3D: The parent Item.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child
parentItem:Add(child)
Item3D item = child:GetParent()
GetPhysicsProperties()
GetPitch()
This action returns the pitch of the model in degrees.
Return
number: The pitch angle, measured in degrees.
GetPosition()
GetPosition will return a Vector3 object containing the X, Y, and Z coordinates of this Item3D object. Note that if this object 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.
Return
Libraries.Compute.Vector3: A new Vector3 object containing the x, y, and z coordinates of this Item, relative to the parent Item (if there is one).
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
myItem:SetX(50)
Vector3 vector = myItem:GetPosition()
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.
GetPropertiesSize()
Return
integer
GetProperty(text key)
GetPropertyKeyIterator()
GetPushVelocity()
GetRenderables(Libraries.Containers.Array<Libraries.Game.Graphics.Renderable> renderables)
GetRenderables is used to retrieve all of the individual renderable components of this Model. This action is used internally by the Game engine. Most users should never need to access this action directly.
Parameters
- Libraries.Containers.Array: An array that will contain all of the retrieved Renderables.
GetResponsiveness()
This action sets the height of the Item.
Return
integer:
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetHeight(210.0)
GetRestitution()
GetX will return the X coordinate of this Item3D in 3D space. Note that if if this object 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.
Return
number: The current x coordinate of this Item, relative to the parent Item (if there is one).
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetX(50)
number x = myItem:GetX()
GetRoll()
This action returns the roll of the model in degrees.
Return
number: The roll angle, measured in degrees.
GetRotationTransform()
This action will return the Matrix4 containing the rotations applied to the Item3D. The values inside the Matrix are used during transform calculations, so they shouldn't be changed unless you know what you're doing!
Return
Libraries.Compute.Matrix4: The Matrix4 used by this item to store and calculate rotations.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Matrix4
Item3D myItem
Matrix4 matrix = myItem:GetRotationTransform()
GetScale()
GetScale returns the scale of the 3D object along all 3 axes.
Return
Libraries.Compute.Vector3: A Vector3 containing the scale along the X, Y, and Z axis
GetScaleX()
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.
Return
number:
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(5, 2, 1)
myItem:Scale(vector, false)
GetScaleY()
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.
Return
number:
Example
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)
GetScaleZ()
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.
Return
number:
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(5, 2, 1)
myItem:Rotate(vector, 90, false)
GetScreenBounds()
This action returns a 2D rectangle describing the approximate bounds of this Item3D on the screen. The rectangle isn't rotated (i.e. the rectangle's edges are aligned with the screen's edges), so the rectangle may be significantly larger than the space taken by the Item3D on the screen in some cases.
Return
GetScreenX()
This action returns the x coordinate of the Item on the screen. If the Item hasn't been attached to a Layer, this will return a "Not a Number" value instead.
Return
number:
GetScreenY()
This action returns the y coordinate of the Item on the screen. If the Item hasn't been attached to a Layer, this will return a "Not a Number" value instead.
Return
number:
GetShaderData()
The Draw action is what makes a Model appear on the screen. This action will automatically be called by the Game class if the Model has been added to the Game with the Add(Item) action. Most users will never need to use this action directly.
Return
GetShaderMapping()
CalculateBoundingBox will compute the bounds of this Model, and then store them inside the provided BoundingBox object. If any data was previously stored in this BoundingBox, it will be overwritten.
Return
Libraries.Game.Graphics.Shaders.ShaderMapping: The given axis-aligned BoundingBox, which will contain the bounds of this Model.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
use Libraries.Game.BoundingBox
class Main is Game
Model cube
BoundingBox box
action Main
StartGame()
end
action CreateGame
Color mint
mint:SetColor(0.5, 1, 0.75, 1)
cube:LoadBox(2, 2, 2, mint)
Add(cube)
cube:CalculateBoundingBox(box)
output "The dimensions of the bounding box are: " + box:GetWidth() + ", " + box:GetHeight() + ", " + box:GetDepth()
end
end
GetShaderProgram()
This action returns the asset file that was used to load this asset. This might be a custom model file (e.g. ".obj") or it might be a texture applied to a primitive (e.g. ".png"). If this model doesn't use an asset file (e.g. it's a non-textured primitive object) then this will remain undefined.
Return
Libraries.Game.Graphics.Shaders.ShaderProgram: The file that was used to load this Model, or undefined if no such file has been used.
GetShape()
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.
Return
Libraries.Game.Collision.Shapes.CollisionShape3D: An array of all Lights stored in this Item3D.
Example
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()
GetShapeType()
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.
Return
integer:
GetSleepTime()
Return
number
GetTimeOfImpact()
transform:Set(matrix)
Return
number:
GetTorque()
This action will increase the x, y, and z coordinates of this Item by the values inside the given Vector3.
Return
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(25, 15, -20)
myItem:SetPosition(50, 25, 80)
myItem:Move(vector)
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.
Return
Libraries.Compute.Matrix4: The Matrix4 used by this item to store and calculate transformations.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Matrix4
Item3D myItem
Matrix4 matrix = myItem:GetTransform()
GetTurnVelocity()
GetWidth()
GetWidth will return the width of this Item3D.
Return
number: The width of this item.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetWidth(50)
number width = myItem:GetWidth()
GetX()
GetX will return the X coordinate of this Item3D in 3D space. Note that if if this object 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.
Return
number: The current x coordinate of this Item, relative to the parent Item (if there is one).
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetX(50)
number x = myItem:GetX()
GetY()
GetY will return the Y coordinate of this Item3D in 3D space. Note that if if this object 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.
Return
number: The current y coordinate of this Item, relative to the parent Item (if there is one).
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetY(50)
number y = myItem:GetY()
GetYaw()
This action returns the yaw of the model in degrees.
Return
number: The yaw angle, measured in degrees.
GetZ()
GetZ will return the Z coordinate of this Item3D in 3D space. Note that if if this object 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.
Return
number: The current z coordinate of this Item, relative to the parent Item (if there is one).
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetZ(50)
number z = myItem:GetZ()
HasMoved()
Return
boolean
HasProperties()
Return
boolean
HasProperty(text key)
Parameters
- text key
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
use Libraries.Interface.Item
Item item
item:Hide()
IntegrateVelocities(number seconds)
Parameters
- number seconds
InternalApplyImpulse(Libraries.Compute.Vector3 linearComponent, Libraries.Compute.Vector3 angularComponent, number impulseMagnitude)
Parameters
- Libraries.Compute.Vector3
- Libraries.Compute.Vector3
- number impulseMagnitude
IsAcceptingMouseInput()
This action returns whether or not this Item accepts mouse input. If the value is true, this will intercept incoming mouse events, triggering any related MouseListeners and InputSets and preventing the mouse event from propagating to other Items on the Layer. The default value is true.
Return
boolean: True if this Item can receive mouse events, or false otherwise.
IsAccessibleParent()
This action returns the nearest parent object that is accessible. This can be anything that the programmer wants to be accessible, from user interface components in a 2D interface to 3D components relative in 3-space on screen. By default, items have no accessible parent and are self-contained, but user interface components normally override the behavior so that controls can be logically nested within each other. attribute: returns Item
Return
boolean:
IsCollidable()
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.
Return
boolean: The Item that was removed.
Example
use Libraries.Interface.Item
Item parentItem
Item child1
Item child2
parentItem:Add(child1)
parentItem:Add(child2)
parentItem:Remove(0)
IsEmpty()
This action returns whether or not any items are contained in this Item.
Return
boolean: Whether or not this item contains any children.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child1
parentItem:Add(child1)
boolean wasEmpty = parentItem:IsEmpty()
IsFastMoving()
This action sets the x, y, and z coordinates of the Item3D.
Return
boolean:
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(50, 200, 35)
myItem:SetPosition(vector)
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:
IsNonResponsive()
Return
boolean
IsOnLayer()
This action returns true if the item has been added to a Layer, or false otherwise.
Return
boolean: True if the item is on a Layer, or false otherwise.
IsPhysicsEnabled()
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).
Return
boolean: The global Z coordinate of this Item (not relative to any parent).
Example
use Libraries.Interface.Item3D
Item3D myItem
Item3D parentItem
parentItem:SetZ(50)
myItem:SetZ(25)
parentItem:Add(myItem)
number z = myItem:GetGlobalZ()
IsResponsive()
Return
boolean
IsRotationAllowed()
Return
boolean
IsShowing()
This action returns whether the Item is currently set to be visible on the screen.
Return
boolean: A boolean representing whether or not the Item is currently visible.
Example
use Libraries.Interface.Item
Item item
item:Hide()
boolean visible = item:IsShowing()
IsSimulated()
Return
boolean
IsSimulationRequired()
This action sets the Y coordinate of the Item.
Return
boolean:
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetY(210.0)
IsUnmovable()
Return
boolean
Load(Libraries.Game.Graphics.ModelBlueprint loader, Libraries.Compute.Matrix4 matrix)
This action will load this Model using the data contained in the given ModelBlueprint, and set its transform using the given Matrix4 (if it is defined).
Parameters
- Libraries.Game.Graphics.ModelBlueprint: The ModelBlueprint to load.
- Libraries.Compute.Matrix4: The Matrix4 used to transform this Model. use Libraries.Game.Game use Libraries.Game.Graphics.Model use Libraries.Game.Graphics.ModelBlueprint use Libraries.Game.Graphics.Color use Libraries.Compute.Matrix4 class Main is Game Model cube Model cubeCopy action Main StartGame() end action CreateGame Color mint mint:SetColor(0.5, 1, 0.75, 1) cube:LoadBox(2, 2, 2, mint) Add(cube) Matrix4 matrix matrix:SetToTranslation(2, 0, 0) matrix:Rotate(0, 1, 0, 45) ModelBlueprint schematic = cube:GetModelBlueprint() cubeCopy:Load(schematic, matrix) Add(cubeCopy) cube:SetX(-2) end end
Load(text fileName)
This action will load the Model file with the given file name from the default file directory. The supported file extensions are .obj, .g3db, and .g3dj.
Parameters
- text fileName: The name of the file to be loaded.
Example
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Game.Graphics.Model
class Main is Game
Model cup
action Main
StartGame()
end
action CreateGame
cup:Load("brown-mug.obj")
Add(cup)
end
end
Load(Libraries.Game.Graphics.ModelBlueprint loader)
This action will load this Model using the data contained in the given ModelBlueprint.
Parameters
- Libraries.Game.Graphics.ModelBlueprint: The ModelBlueprint to load.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.ModelBlueprint
use Libraries.Game.Graphics.Color
class Main is Game
Model cube
Model cubeCopy
action Main
StartGame()
end
action CreateGame
Color mint
mint:SetColor(0.5, 1, 0.75, 1)
cube:LoadBox(2, 2, 2, mint)
Add(cube)
ModelBlueprint schematic = cube:GetModelBlueprint()
cubeCopy:Load(schematic)
Add(cubeCopy)
cube:SetX(-2)
cubeCopy:SetX(2)
end
end
Load(Libraries.System.File file)
This action will load a model from a given model file. The supported file extensions are .obj, .g3db, and .g3dj.
Parameters
- Libraries.System.File: The file containing the model data to be loaded.
Example
use Libraries.Game.Game
use Libraries.System.File
use Libraries.Game.Graphics.Model
class Main is Game
Model hat
action Main
StartGame()
end
action CreateGame
File file
file:SetPath("Sombrero.obj")
hat:Load(file)
Add(hat)
end
end
LoadBox(number width, number height, number depth, Libraries.Game.Graphics.Color color)
This action will load the Model with a box with the given width, height, depth, and color.
Parameters
- number width: How long the box should be along the x-axis.
- number height: How long the box should be along the y-axis.
- number depth: How long the box should be along the z-axis.
- Libraries.Game.Graphics.Color: What color the box should be.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
Color cyan
cyan:SetColor(0, 0.75, 1, 1)
cube:LoadBox(2, 2, 2, cyan)
Add(cube)
end
end
LoadBox(number width, number height, number depth, text textureFile)
This action will load the Model with a box with the given width, height, and depth. The box will use the texture located at the provided file path.
Parameters
- number width: How long the box should be along the x-axis.
- number height: How long the box should be along the y-axis.
- number depth: How long the box should be along the z-axis.
- text textureFile: The name of a texture file to be displayed on each side of the box.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
cube:LoadBox(2, 2, 2, "Box.png")
Add(cube)
end
end
LoadBox(number width, number height, number depth, Libraries.Game.Graphics.Drawable drawable)
This action will load the Model with a box with the given width, height, and depth. The box will use the texture that has been loaded by the given Drawable.
Parameters
- number width: How long the box should be along the x-axis.
- number height: How long the box should be along the y-axis.
- number depth: How long the box should be along the z-axis.
- Libraries.Game.Graphics.Drawable: A loaded Drawable containing an image to be used on each side of the box.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Drawable
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
Drawable logo
logo:Load("Logo.png")
cube:LoadBox(2, 2, 2, logo)
Add(cube)
end
end
LoadBox(number width, number height, number depth, Libraries.System.File textureFile)
This action will load the Model with a box with the given width, height, and depth. The box will use the texture located in the provided file.
Parameters
- number width: How long the box should be along the x-axis.
- number height: How long the box should be along the y-axis.
- number depth: How long the box should be along the z-axis.
- Libraries.System.File: A file containing a texture to show on each side of the box.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.System.File
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
File texture
texture:SetPath("Crate.png")
cube:LoadBox(2, 2, 2, texture)
Add(cube)
end
end
LoadBox(number width, number height, number depth, Libraries.Game.Graphics.Texture texture)
This action will load the Model with a box with the given width, height, depth, and texture.
Parameters
- number width: How long the box should be along the x-axis.
- number height: How long the box should be along the y-axis.
- number depth: How long the box should be along the z-axis.
- Libraries.Game.Graphics.Texture
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Texture
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
Texture texture
texture:LoadFilledCircle(150)
cube:LoadBox(2, 2, 2, texture)
Add(cube)
end
end
LoadCylinder(number width, number height, number depth, Libraries.Game.Graphics.Drawable drawable)
This action will load the Model with a cylinder with the given dimensions, using the texture contained in the given (loaded) Drawable. The curve of the cylinder will be approximated using 16 straight edges.
Parameters
- number width: How long the cylinder should be along the x-axis.
- number height: How long the cylinder should be along the y-axis.
- number depth: How long the cylinder should be along the z-axis.
- Libraries.Game.Graphics.Drawable: A loaded Drawable to draw onto the cylinder.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Drawable
class Main is Game
Model tube
action Main
StartGame()
end
action CreateGame
Drawable image
image:Load("Pillar.png")
tube:LoadCylinder(2, 2, 2, image)
Add(tube)
end
end
LoadCylinder(number width, number height, number depth, text textureFile)
This action will load the Model with a cylinder with the given dimensions and texture. The curve of the cylinder will be approximated using 16 straight edges.
Parameters
- number width: How long the cylinder should be along the x-axis.
- number height: How long the cylinder should be along the y-axis.
- number depth: How long the cylinder should be along the z-axis.
- text textureFile: The name of a file containing the texture to draw onto the cylinder.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
class Main is Game
Model tube
action Main
StartGame()
end
action CreateGame
tube:LoadCylinder(2, 2, 2, "Barrel.png")
Add(tube)
end
end
LoadCylinder(number width, number height, number depth, Libraries.Game.Graphics.Color color)
This action will load the Model with a cylinder with the given width, height, depth, and color. The default cylinder will be made using 16 straight sides to simulate the curve of the cylinder.
Parameters
- number width: How long the cylinder should be along the x-axis.
- number height: How long the cylinder should be along the y-axis.
- number depth: How long the cylinder should be along the z-axis.
- Libraries.Game.Graphics.Color: What color the cylinder should be.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
class Main is Game
Model tube
action Main
StartGame()
end
action CreateGame
Color orange
orange:SetColor(1, 0.5, 0, 1)
tube:LoadCylinder(2, 2, 2, orange)
Add(tube)
end
end
LoadCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Drawable drawable)
This action will load the Model with a cylinder with the given dimensions and using the texture contained in the provided Drawable. The Drawable must be loaded. The provided number of divisions will be used to simulate the curve of the cylinder - the more divisions used, the smoother the curve will appear.
Parameters
- number width: How long the cylinder should be along the x-axis.
- number height: How long the cylinder should be along the y-axis.
- number depth: How long the cylinder should be along the z-axis.
- integer divisions: How many straight edges to use to simulate the curve of the cylinder.
- Libraries.Game.Graphics.Drawable: A loaded Drawable that contains a texture to be displayed on the cylinder.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Drawable
class Main is Game
Model tube
action Main
StartGame()
end
action CreateGame
Drawable image
image:Load("Steel.png")
tube:LoadCylinder(2, 2, 2, 8, image)
Add(tube)
end
end
LoadCylinder(number width, number height, number depth, integer divisions, Libraries.System.File textureFile)
This action will load the Model with a cylinder with the given dimensions and texture. The provided number of divisions will be used to simulate the curve of the cylinder - the more divisions used, the smoother the curve will appear.
Parameters
- number width: How long the cylinder should be along the x-axis.
- number height: How long the cylinder should be along the y-axis.
- number depth: How long the cylinder should be along the z-axis.
- integer divisions: How many straight edges to use to simulate the curve of the cylinder.
- Libraries.System.File: A texture file containing the texture to display on the cylinder.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.System.File
class Main is Game
Model tube
action Main
StartGame()
end
action CreateGame
File image
image:SetPath("Steel.png")
tube:LoadCylinder(2, 2, 2, 8, image)
Add(tube)
end
end
LoadCylinder(number width, number height, number depth, Libraries.System.File textureFile)
This action will load the Model with a cylinder with the given dimensions and texture. The curve of the cylinder will be approximated using 16 straight edges.
Parameters
- number width: How long the cylinder should be along the x-axis.
- number height: How long the cylinder should be along the y-axis.
- number depth: How long the cylinder should be along the z-axis.
- Libraries.System.File: A file containing the texture to draw onto the cylinder.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.System.File
class Main is Game
Model tube
action Main
StartGame()
end
action CreateGame
File file
file:SetPath("Trunk.png")
tube:LoadCylinder(2, 2, 2, file)
Add(tube)
end
end
LoadCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Texture texture)
This action will load the Model with a cylinder with the given dimensions and texture. The provided number of divisions will be used to simulate the curve of the cylinder - the more divisions used, the smoother the curve will appear.
Parameters
- number width: How long the cylinder should be along the x-axis.
- number height: How long the cylinder should be along the y-axis.
- number depth: How long the cylinder should be along the z-axis.
- integer divisions: How many straight edges to use to simulate the curve of the cylinder.
- Libraries.Game.Graphics.Texture: The texture to draw on the sides of the cylinder.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Texture
class Main is Game
Model tube
action Main
StartGame()
end
action CreateGame
Texture texture
texture:LoadFromFile("Cable.png")
tube:LoadCylinder(2, 2, 2, 8, texture)
Add(tube)
end
end
LoadCylinder(number width, number height, number depth, Libraries.Game.Graphics.Texture texture)
This action will load the Model with a cylinder with the given dimensions and texture. The curve of the cylinder will be approximated using 16 straight edges.
Parameters
- number width: How long the cylinder should be along the x-axis.
- number height: How long the cylinder should be along the y-axis.
- number depth: How long the cylinder should be along the z-axis.
- Libraries.Game.Graphics.Texture: The texture to be drawn onto the cylinder.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Texture
class Main is Game
Model tube
action Main
StartGame()
end
action CreateGame
Texture texture
texture:LoadFromFile("Stripes.png")
tube:LoadCylinder(2, 2, 2, texture)
Add(tube)
end
end
LoadCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Color color)
This action will load the Model with a cylinder with the given dimensions and color. The provided number of divisions will be used to simulate the curve of the cylinder - the more divisions used, the smoother the curve will appear.
Parameters
- number width: How long the cylinder should be along the x-axis.
- number height: How long the cylinder should be along the y-axis.
- number depth: How long the cylinder should be along the z-axis.
- integer divisions: How many straight edges to use to simulate the curve of the cylinder.
- Libraries.Game.Graphics.Color: What color the cylinder should be.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
class Main is Game
Model tube
action Main
StartGame()
end
action CreateGame
Color orange
orange:SetColor(1, 0.5, 0, 1)
tube:LoadCylinder(2, 2, 2, 8, orange)
Add(tube)
end
end
LoadCylinder(number width, number height, number depth, integer divisions, text textureFile)
This action will load the Model with a cylinder with the given dimensions and texture. The provided number of divisions will be used to simulate the curve of the cylinder - the more divisions used, the smoother the curve will appear.
Parameters
- number width: How long the cylinder should be along the x-axis.
- number height: How long the cylinder should be along the y-axis.
- number depth: How long the cylinder should be along the z-axis.
- integer divisions: How many straight edges to use to simulate the curve of the cylinder.
- text textureFile: The name of a file containing the texture to display on the cylinder.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
class Main is Game
Model tube
action Main
StartGame()
end
action CreateGame
tube:LoadCylinder(2, 2, 2, 8, "Concrete.png")
Add(tube)
end
end
LoadPlane(number width, number depth, Libraries.Game.Graphics.Texture texture)
This action will load the Model with a plane with the given width, depth, and texture.
Parameters
- number width: How long the plane should be along the x-axis.
- number depth: How long the plane should be along the z-axis.
- Libraries.Game.Graphics.Texture
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Texture
class Main is Game
Model plane
action Main
StartGame()
end
action CreateGame
Texture texture
texture:LoadFilledCircle(150)
plane:LoadPlane(2, 2, texture)
Add(plane)
end
end
LoadPlane(number width, number depth, text textureFile, boolean doubleSided)
This action will load the Model with a plane with the given width and depth. The plane will use the texture located at the provided file path. If the boolean value provided is true, it will be double sided (allowing it to be viewed from both sides of the plane) -- otherwise, it will only visible along the top of the plane.
Parameters
- number width: How long the plane should be along the x-axis.
- number depth: How long the plane should be along the z-axis.
- text textureFile: The name of a texture file to be displayed on the surface of the plane.
- boolean doubleSided: True to make the plane double-sided, false otherwise.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
class Main is Game
Model plane
action Main
StartGame()
end
action CreateGame
plane:LoadPlane(2, 2, "Box.png", true)
Add(plane)
end
end
LoadPlane(number width, number depth, text textureFile)
This action will load the Model with a plane with the given width and depth. The plane will use the texture located at the provided file path.
Parameters
- number width: How long the plane should be along the x-axis.
- number depth: How long the plane should be along the z-axis.
- text textureFile: The name of a texture file to be displayed on the surface of the plane.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
class Main is Game
Model plane
action Main
StartGame()
end
action CreateGame
plane:LoadPlane(2, 2, "Box.png")
Add(plane)
end
end
LoadPlane(number width, number depth, Libraries.Game.Graphics.Drawable drawable, boolean doubleSided)
This action will load the Model with a plane with the given width and depth. The plane will use the texture that has been loaded by the given Drawable. If the boolean value provided is true, it will be double sided (allowing it to be viewed from both sides of the plane) -- otherwise, it will only visible along the top of the plane.
Parameters
- number width: How long the plane should be along the x-axis.
- number depth: How long the plane should be along the z-axis.
- Libraries.Game.Graphics.Drawable: A loaded Drawable containing an image to be used on the surface of the plane.
- boolean doubleSided: True to make the plane double-sided, false otherwise.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Drawable
class Main is Game
Model plane
action Main
StartGame()
end
action CreateGame
Drawable logo
logo:Load("Logo.png")
plane:LoadPlane(2, 2, logo, true)
Add(plane)
end
end
LoadPlane(number width, number depth, Libraries.System.File textureFile)
This action will load the Model with a plane with the given width and depth. The plane will use the texture located in the provided file.
Parameters
- number width: How long the plane should be along the x-axis.
- number depth: How long the plane should be along the z-axis.
- Libraries.System.File: A file containing a texture to show on the surface of the plane.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.System.File
class Main is Game
Model plane
action Main
StartGame()
end
action CreateGame
File texture
texture:SetPath("Floor.png")
plane:LoadPlane(2, 2, texture)
Add(plane)
end
end
LoadPlane(number width, number depth, Libraries.Game.Graphics.Color color, boolean doubleSided)
This action will load the Model with a plane with the given width, depth, and color. If the boolean value provided is true, it will be double sided (allowing it to be viewed from both sides of the plane) -- otherwise, it will only visible along the top of the plane.
Parameters
- number width: How long the plane should be along the x-axis.
- number depth: How long the plane should be along the z-axis.
- Libraries.Game.Graphics.Color: What color the plane should be.
- boolean doubleSided: True to make the plane double-sided, false otherwise.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
class Main is Game
Model plane
action Main
StartGame()
end
action CreateGame
Color cyan
cyan:SetColor(0, 0.75, 1, 1)
plane:LoadPlane(2, 2, cyan, true)
Add(plane)
end
end
LoadPlane(number width, number depth, Libraries.Game.Graphics.Texture texture, boolean doubleSided)
This action will load the Model with a plane with the given width, depth, and texture. If the boolean value provided is true, it will be double sided (allowing it to be viewed from both sides of the plane) -- otherwise, it will only visible along the top of the plane.
Parameters
- number width: How long the plane should be along the x-axis.
- number depth: How long the plane should be along the z-axis.
- Libraries.Game.Graphics.Texture
- boolean doubleSided: True to make the plane double-sided, false otherwise.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Texture
class Main is Game
Model plane
action Main
StartGame()
end
action CreateGame
Texture texture
texture:LoadFilledCircle(150)
plane:LoadPlane(2, 2, texture, true)
Add(plane)
end
end
LoadPlane(number width, number depth, Libraries.Game.Graphics.Color color)
This action will load the Model with a plane with the given width, depth, and color.
Parameters
- number width: How long the plane should be along the x-axis.
- number depth: How long the plane should be along the z-axis.
- Libraries.Game.Graphics.Color: What color the plane should be.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
class Main is Game
Model plane
action Main
StartGame()
end
action CreateGame
Color cyan
cyan:SetColor(0, 0.75, 1, 1)
plane:LoadPlane(2, 2, cyan)
Add(plane)
end
end
LoadPlane(number width, number depth, Libraries.Game.Graphics.Drawable drawable)
This action will load the Model with a plane with the given width and depth. The plane will use the texture that has been loaded by the given Drawable.
Parameters
- number width: How long the plane should be along the x-axis.
- number depth: How long the plane should be along the z-axis.
- Libraries.Game.Graphics.Drawable: A loaded Drawable containing an image to be used on the surface of the plane.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Drawable
class Main is Game
Model plane
action Main
StartGame()
end
action CreateGame
Drawable logo
logo:Load("Logo.png")
plane:LoadPlane(2, 2, logo)
Add(plane)
end
end
LoadPlane(number width, number depth, Libraries.System.File textureFile, boolean doubleSided)
This action will load the Model with a plane with the given width and depth. The plane will use the texture located in the provided file. If the boolean value provided is true, it will be double sided (allowing it to be viewed from both sides of the plane) -- otherwise, it will only visible along the top of the plane.
Parameters
- number width: How long the plane should be along the x-axis.
- number depth: How long the plane should be along the z-axis.
- Libraries.System.File: A file containing a texture to show on the surface of the plane.
- boolean doubleSided: True to make the plane double-sided, false otherwise.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.System.File
class Main is Game
Model plane
action Main
StartGame()
end
action CreateGame
File texture
texture:SetPath("Floor.png")
plane:LoadPlane(2, 2, texture, true)
Add(plane)
end
end
LoadSphere(number width, number height, number depth, integer horizontalDivisions, integer verticalDivisions, text textureFile)
This action will load the Model with a sphere with the given dimensions and texture. The provided number of divisions will be used to simulate the curve of the sphere - the more divisions used, the smoother the curve will appear.
Parameters
- number width: How long the sphere should be along the x-axis.
- number height: How long the sphere should be along the y-axis.
- number depth: How long the sphere should be along the z-axis.
- integer horizontalDivisions: How many straight edges to use on the horizontal plane to simulate the curve of the sphere.
- integer verticalDivisions: How many straight edges to use on the vertical plane to simulate the curve of the sphere.
- text textureFile: The name of a file containing the texture to display on the sphere.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
class Main is Game
Model ball
action Main
StartGame()
end
action CreateGame
ball:LoadSphere(2, 2, 2, 12, 8, "Concrete.png")
Add(ball)
end
end
LoadSphere(number width, number height, number depth, integer horizontalDivisions, integer verticalDivisions, Libraries.System.File textureFile)
This action will load the Model with a sphere with the given dimensions and texture. The provided number of divisions will be used to simulate the curve of the sphere - the more divisions used, the smoother the curve will appear.
Parameters
- number width: How long the sphere should be along the x-axis.
- number height: How long the sphere should be along the y-axis.
- number depth: How long the sphere should be along the z-axis.
- integer horizontalDivisions: How many straight edges to use on the horizontal plane to simulate the curve of the sphere.
- integer verticalDivisions: How many straight edges to use on the vertical plane to simulate the curve of the sphere.
- Libraries.System.File: A texture file containing the texture to display on the sphere.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.System.File
class Main is Game
Model ball
action Main
StartGame()
end
action CreateGame
File image
image:SetPath("Steel.png")
ball:LoadSphere(2, 2, 2, 12, 8, image)
Add(ball)
end
end
LoadSphere(number width, number height, number depth, Libraries.Game.Graphics.Color color)
This action will load the Model with a sphere with the given width, height, depth, and color. The default sphere will be made using 25 straight sides on the horizontal plane and 16 straight sides on the vertical plane to simulate the curve of a true sphere.
Parameters
- number width: How long the sphere should be along the x-axis.
- number height: How long the sphere should be along the y-axis.
- number depth: How long the sphere should be along the z-axis.
- Libraries.Game.Graphics.Color: What color the sphere should be.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
class Main is Game
Model ball
action Main
StartGame()
end
action CreateGame
Color orange
orange:SetColor(1, 0.65, 0, 1)
ball:LoadSphere(2, 2, 2, orange)
Add(ball)
end
end
LoadSphere(number width, number height, number depth, integer horizontalDivisions, integer verticalDivisions, Libraries.Game.Graphics.Color color)
This action will load the Model with a sphere with the given dimensions and color. The provided number of divisions will be used to simulate the curve of the sphere - the more divisions used, the smoother the curve will appear.
Parameters
- number width: How long the sphere should be along the x-axis.
- number height: How long the sphere should be along the y-axis.
- number depth: How long the sphere should be along the z-axis.
- integer horizontalDivisions: How many straight edges to use on the horizontal plane to simulate the curve of the sphere.
- integer verticalDivisions: How many straight edges to use on the vertical plane to simulate the curve of the sphere.
- Libraries.Game.Graphics.Color: What color the sphere should be.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
class Main is Game
Model ball
action Main
StartGame()
end
action CreateGame
Color orange
orange:SetColor(1, 0.65, 0, 1)
tube:LoadSphere(2, 2, 2, 12, 8, orange)
Add(tube)
end
end
LoadSphere(number width, number height, number depth, Libraries.System.File textureFile)
This action will load the Model with a sphere with the given dimensions and texture. The curve of the sphere will be approximated using 25 straight edges along the horizontal plane, and 16 straight edges along the vertical plane.
Parameters
- number width: How long the sphere should be along the x-axis.
- number height: How long the sphere should be along the y-axis.
- number depth: How long the sphere should be along the z-axis.
- Libraries.System.File: A file containing the texture to draw onto the sphere.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.System.File
class Main is Game
Model ball
action Main
StartGame()
end
action CreateGame
File file
file:SetPath("Rubber.png")
ball:LoadSphere(2, 2, 2, file)
Add(ball)
end
end
LoadSphere(number width, number height, number depth, integer horizontalDivisions, integer verticalDivisions, Libraries.Game.Graphics.Texture texture)
This action will load the Model with a sphere with the given dimensions and texture. The provided number of divisions will be used to simulate the curve of the sphere - the more divisions used, the smoother the curve will appear.
Parameters
- number width: How long the sphere should be along the x-axis.
- number height: How long the sphere should be along the y-axis.
- number depth: How long the sphere should be along the z-axis.
- integer horizontalDivisions: How many straight edges to use on the horizontal plane to simulate the curve of the sphere.
- integer verticalDivisions: How many straight edges to use on the vertical plane to simulate the curve of the sphere.
- Libraries.Game.Graphics.Texture: The texture to draw on the sides of the sphere.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Texture
class Main is Game
Model ball
action Main
StartGame()
end
action CreateGame
Texture texture
texture:LoadFromFile("Orb.png")
ball:LoadSphere(2, 2, 2, 12, 8, texture)
Add(ball)
end
end
LoadSphere(number width, number height, number depth, integer horizontalDivisions, integer verticalDivisions, Libraries.Game.Graphics.Drawable drawable)
This action will load the Model with a sphere with the given dimensions and using the texture contained in the provided Drawable. The Drawable must be loaded. The provided number of divisions will be used to simulate the curve of the sphere - the more divisions used, the smoother the curve will appear.
Parameters
- number width: How long the sphere should be along the x-axis.
- number height: How long the sphere should be along the y-axis.
- number depth: How long the sphere should be along the z-axis.
- integer horizontalDivisions: How many straight edges to use on the horizontal plane to simulate the curve of the sphere.
- integer verticalDivisions: How many straight edges to use on the vertical plane to simulate the curve of the sphere.
- Libraries.Game.Graphics.Drawable: A loaded Drawable that contains a texture to be displayed on the sphere.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Drawable
class Main is Game
Model ball
action Main
StartGame()
end
action CreateGame
Drawable image
image:Load("Steel.png")
ball:LoadSphere(2, 2, 2, 12, 8, image)
Add(ball)
end
end
LoadSphere(number width, number height, number depth, Libraries.Game.Graphics.Texture texture)
This action will load the Model with a sphere with the given dimensions and texture. The curve of the cylinder will be approximated using 25 straight edges along the horizontal plane, and 16 straight edges along the vertical plane.
Parameters
- number width: How long the sphere should be along the x-axis.
- number height: How long the sphere should be along the y-axis.
- number depth: How long the sphere should be along the z-axis.
- Libraries.Game.Graphics.Texture: The texture to be drawn onto the sphere.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Texture
class Main is Game
Model ball
action Main
StartGame()
end
action CreateGame
Texture texture
texture:LoadFromFile("Stripes.png")
ball:LoadBall(2, 2, 2, texture)
Add(ball)
end
end
LoadSphere(number width, number height, number depth, Libraries.Game.Graphics.Drawable drawable)
This action will load the Model with a sphere with the given dimensions, using the texture contained in the given (loaded) Drawable. The curve of the sphere will be approximated using 25 straight edges along the horizontal plane and 16 straight edges along the vertical plane.
Parameters
- number width: How long the sphere should be along the x-axis.
- number height: How long the sphere should be along the y-axis.
- number depth: How long the sphere should be along the z-axis.
- Libraries.Game.Graphics.Drawable: A loaded Drawable to draw onto the sphere.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Drawable
class Main is Game
Model ball
action Main
StartGame()
end
action CreateGame
Drawable image
image:Load("Plaid.png")
ball:LoadSphere(2, 2, 2, image)
Add(ball)
end
end
LoadSphere(number width, number height, number depth, text textureFile)
This action will load the Model with a sphere with the given dimensions and texture. The curve of the cylinder will be approximated using 25 straight edges along the horizontal plane, and 16 straight edges along the vertical plane.
Parameters
- number width: How long the sphere should be along the x-axis.
- number height: How long the sphere should be along the y-axis.
- number depth: How long the sphere should be along the z-axis.
- text textureFile: The name of a file containing the texture to draw onto the sphere.
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
class Main is Game
Model ball
action Main
StartGame()
end
action CreateGame
ball:LoadSphere(2, 2, 2, "Cannonball.png")
Add(ball)
end
end
LostFocus(Libraries.Interface.Events.FocusEvent event)
Move(Libraries.Compute.Vector3 vector)
This action will increase the x, y, and z coordinates of this Item by the values inside the given Vector3.
Parameters
- Libraries.Compute.Vector3: A vector describing how much to increase the current x, y, and z coordinates of this item by.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(25, 15, -20)
myItem:SetPosition(50, 25, 80)
myItem:Move(vector)
Move(number xAmount, number yAmount, number zAmount)
This action will increase the x, y, and z coordinates of this Item by the given amounts.
Parameters
- number xAmount: How much to increase the current x coordinate of this item by.
- number yAmount: How much to increase the current y coordinate of this item by.
- number zAmount: How much to increase the current z coordinate of this item by.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetPosition(50, 25, 80)
myItem:Move(25, 15, -20)
MoveX(number xAmount)
This action will increase the x-coordinate of this Item by the given amount.
Parameters
- number xAmount: How much to increase the current x coordinate of this item by.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetX(50)
myItem:MoveX(25)
MoveY(number yAmount)
This action will increase the y-coordinate of this Item by the given amount.
Parameters
- number yAmount: How much to increase the current y coordinate of this item by.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetY(50)
myItem:MoveY(25)
MoveZ(number zAmount)
This action will increase the z-coordinate of this Item by the given amount.
Parameters
- number zAmount: How much to increase the current z coordinate of this item by.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetZ(50)
myItem:MoveZ(25)
PredictIntegratedTransform(number seconds, Libraries.Game.Collision.PhysicsPosition3D predictedTransform)
Parameters
- number seconds
- Libraries.Game.Collision.PhysicsPosition3D
ProceedToTransform(Libraries.Game.Collision.PhysicsPosition3D transform)
ProcessGestureEvent(Libraries.Interface.Events.GestureEvent event)
This action takes a gesture event and handles it. It will first test to see if the gesture event took place within the bounds of this Item. If so, it will notify any GestureListeners of the event. If the event was not contained within this Item, or if there are no GestureListeners on this Item, the Item will ask its parent Item to process the event, if there is a parent.
Parameters
Example
use Libraries.Interface.Item3D
use Libraries.Interface.Events.GestureEvent
use Libraries.Interface.Events.GestureListener
Item3D myItem
GestureListener listener
myItem:AddGestureListener(listener)
GestureEvent event
event:eventType = event:DOUBLE_TAP
myItem:ProcessGestureEvent(event)
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.
Parameters
Example
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)
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.
Parameters
- Libraries.Interface.Events.TouchEvent: The TouchEvent to process.
Example
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)
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.
Parameters
- integer index: The index to remove from the children array.
Return
Libraries.Interface.Item3D: The Item that was removed.
Example
use Libraries.Interface.Item
Item parentItem
Item child1
Item child2
parentItem:Add(child1)
parentItem:Add(child2)
parentItem:Remove(0)
Remove(Libraries.Interface.Item3D removed)
This action removes an Item3D that was previously added to this Item3D.
Parameters
Return
boolean: Whether or not the item was found and removed.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child1
Item3D child2
parentItem:Add(child1)
parentItem:Add(child2)
parentItem:Remove(child1)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.FocusListener
Item myItem
FocusListener listener
myItem:AddFocusListener(listener)
myItem:RemoveFocusListener(listener)
RemoveGestureListener(Libraries.Interface.Events.GestureListener listener)
This action removes a GestureListener from the Item. The listener will no longer receive notification if the Item gets a GestureEvent.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.GestureListener
Item myItem
GestureListener listener
myItem:AddGestureListener(listener)
myItem:RemoveGestureListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseListener
Item myItem
MouseListener listener
myItem:AddMouseListener(listener)
myItem:RemoveMouseListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseMovementListener
Item myItem
MouseMovementListener listener
myItem:AddMouseMovementListener(listener)
myItem:RemoveMouseMovementListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.MouseWheelListener
Item myItem
MouseWheelListener listener
myItem:AddMouseWheelListener(listener)
myItem:RemoveMouseWheelListener(listener)
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.
Parameters
Example
use Libraries.Interface.Item
use Libraries.Interface.Events.TouchListener
Item myItem
TouchListener listener
myItem:AddTouchListener(listener)
myItem:RemoveTouchListener(listener)
RequireSimulation(boolean flag)
This action sets the Z coordinate of the Item.
Parameters
- boolean flag
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetZ(210.0)
ResetMass()
ResetScale()
ResetScale sets the scale of the object along each axis to the default which is usually 1. The scale of the object affects how large it is in the scene. So a scale of 2 on the x-axis means the object is twice as big on the x-axis than when normally sized.
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.
Parameters
- Libraries.Compute.Vector3: The axis or ray to rotate around.
- number degrees: How many degrees to rotate (clockwise).
- boolean rotateChildren: Whether or not children should be rotated around the parent.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(5, 2, 1)
myItem:Rotate(vector, 90, false)
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.
Parameters
- Libraries.Compute.Vector3: The axis or ray to rotate around.
- number degrees: How many degrees to rotate (clockwise).
Example
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)
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.
Parameters
- number rotateX: The x component of the ray to rotate around.
- number rotateY: The y component of the ray to rotate around.
- number rotateZ: The z component of the ray to rotate around.
- number degrees: How many degrees to rotate (clockwise).
Example
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)
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.
Parameters
- number rotateX: The x component of the ray to rotate around.
- number rotateY: The y component of the ray to rotate around.
- number rotateZ: The z component of the ray to rotate around.
- number degrees: How many degrees to rotate (clockwise).
- boolean rotateChildren: Whether or not children should be rotated around the parent.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:Rotate(5, 2, 1, 90, false)
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.
Parameters
- Libraries.Compute.Vector3: The point in space to rotate around.
- Libraries.Compute.Vector3: The axis that determines the direction to rotate in.
- number degrees: How many degrees to rotate (clockwise) around the axis.
Example
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)
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.
Parameters
- Libraries.Compute.Vector3: The point in space to rotate around.
- Libraries.Compute.Vector3: The axis that determines the direction to rotate in.
- number degrees: How many degrees to rotate (clockwise) around the axis.
- boolean rotateChildren: Whether or not to also rotate this item's children.
Example
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)
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.
Parameters
- number rotateX: The x component of the ray to rotate around.
- number rotateY: The y component of the ray to rotate around.
- number rotateZ: The z component of the ray to rotate around.
- number degrees: How many degrees to rotate (clockwise).
Example
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)
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.
Parameters
- Libraries.Compute.Vector3: The axis or ray to rotate around.
- number degrees: How many degrees to rotate (clockwise).
Example
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)
SaveKinematicState(number time)
Parameters
- number time
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.
Parameters
- Libraries.Compute.Vector3: A Vector3 object describing how much to scale the Item3D by along the x, y, and z axes.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(5, 2, 1)
myItem:Scale(vector)
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.
Parameters
- Libraries.Compute.Vector3: A Vector3 object describing how much to scale the Item3D by along the x, y, and z axes.
- boolean scaleChildren: Whether or not children objects should also be scaled.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(5, 2, 1)
myItem:Scale(vector, false)
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.
Parameters
- number scaleX: How much to scale the Item3D along the x-axis.
- number scaleY: How much to scale the Item3D along the y-axis.
- number scaleZ: How much to scale the Item3D along the z-axis.
- boolean scaleChildren: Whether or not children objects should also be scaled.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:Scale(5, 2, 1, false)
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.
Parameters
- number scaleX: How much to scale the Item3D along the x-axis.
- number scaleY: How much to scale the Item3D along the y-axis.
- number scaleZ: How much to scale the Item3D along the z-axis.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:Scale(5, 2, 1)
SetAcceptsMouseInput(boolean accepts)
This action sets whether or not this Item accepts mouse input. If set to true, this will intercept incoming mouse events, triggering any related MouseListeners and InputSets and preventing the mouse event from propagating to other Items on the Layer. The default value is true.
Parameters
- boolean accepts: True to set this Item to receive mouse events, or false to ignore them.
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
- integer newAccessibilityCode: the new accessibility code for this Item.
SetAccessibilityRoleDescription(text newRoleDescription)
This action sets a custom accessibility role description for this item. This should only be done if there is not a standard accessibility code for the type of item being implemented. If the item behaves very similarly to a standard control type, then set the accessibility code to that standard type while also setting the role description. For example, if implementing an item that extends Control, is keyboard focusable, and responds to activation via both mouse clicks and the Space key, like a button, but it shouldn't be described as a button, then set the accessibility code to BUTTON and the custom role description to whatever is appropriate. If there isn't a suitable accessibility code, or if in doubt, set the accessibility code to CUSTOM.
Parameters
- text newRoleDescription: the new custom role description for this Item.
SetAngularDamping(number angularDamping)
This action sets the depth the Item.
Parameters
- number angularDamping
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetDepth(210.0)
SetAngularVelocity(Libraries.Compute.Vector3 angularVelocity)
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.
Parameters
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffset(75, 40, 35)
SetCenterOfMassTransform(Libraries.Game.Collision.PhysicsPosition3D transform)
SetCollidable(boolean flag)
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.
Parameters
- boolean flag
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child1
Item3D child2
parentItem:Add(child1)
parentItem:Add(child2)
Item3D temp = parentItem:GetItem(0)
SetCollideWithChildren(boolean flag)
Parameters
- boolean flag
SetCollisionGroupFlag(boolean flag)
This action lets the 3D collision solver actions (inside the class CollisionSolver3D) know that if this object needs its physics to be updated.
Parameters
- boolean flag: True if physics needs to be updated; false if physics doesn't need to be updated, which is when this object is a "unmovable" object in the physics space.
SetCollisionGroupIndex(integer index)
This action sets where in the "list of objects that needs to be updated because collision happened" that this object resides in. This "list of objects that needs to be updated because collision happened" is stored inside the CollisionSolver3D class as tempSolverBodyPool.
Parameters
- integer index: the index at which this object resides in in the tempSolverBodyPool.
SetCollisionList(Libraries.Game.Collision.CollisionEdge3D list)
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
SetCollisionTransform(Libraries.Game.Collision.PhysicsPosition3D transform)
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.
Parameters
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child
parentItem:Add(child)
SetCollisionTransform0(Libraries.Game.Collision.PhysicsPosition3D transform)
SetColor(Libraries.Game.Graphics.Color color)
This action sets the diffuse color of a primitive model. If the model did not previously have a color applied to it, it will add a color to it.
Parameters
SetDepth(number setDepth)
This action sets the depth the Item.
Parameters
- number setDepth: The new depth.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetDepth(210.0)
SetDescription(text newDescription)
This action sets the internal description of the Item.
Parameters
- text newDescription
Example
use Libraries.Interface.Item
Item item
item:SetDescription("Used for demo purposes.")
SetDimensions(number setWidth, number setHeight, number setDepth)
This action sets the width, height, and depth of the Item3D.
Parameters
- number setWidth: The new width.
- number setHeight: The new height.
- number setDepth: The new depth.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetDimensions(50, 200, 35)
SetDimensions(Libraries.Compute.Vector3 vector)
This action sets the width, height, and depth of the Item3D.
Parameters
- Libraries.Compute.Vector3: A vector containing the new width, height, and depth.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(50, 200, 35)
myItem:SetDimensions(vector)
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
- boolean focus
SetForce(Libraries.Compute.Vector3 force)
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.
Parameters
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetY(75)
SetFriction(number friction)
GetPosition will return a Vector3 object containing the X, Y, and Z coordinates of this Item3D object. Note that if this object 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.
Parameters
- number friction
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
myItem:SetX(50)
Vector3 vector = myItem:GetPosition()
SetHasMoved(boolean flag)
Parameters
- boolean flag
SetHeight(number setHeight)
This action sets the height of the Item.
Parameters
- number setHeight: The new height.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetHeight(210.0)
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.
Parameters
- text group: The new input group to use.
Example
use Libraries.Interface.Item
Item item
item:SetInputGroup("arrowKeys")
output "My item's input group is : " + item:GetInputGroup()
SetInterpolatedAngularVelocity(Libraries.Compute.Vector3 velocity)
Parameters
SetInterpolatedLinearVelocity(Libraries.Compute.Vector3 velocity)
Parameters
SetInterpolationTransform(Libraries.Game.Collision.PhysicsPosition3D transform)
This action copies the values of the provided Matrix4 into this item's rotation transform, effectively allowing you to copy rotations from one object to another.
Parameters
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Matrix4
Item3D item1
item1:Rotate(1, 0, 1, 45)
Matrix4 rotation = item1:GetRotationTransform()
// Copy the rotation from item1 into a new Item, item2
Item3D item2
item2:SetRotationTransform(rotation)
SetItem(integer index, Libraries.Interface.Item3D newItem)
This action sets a value inside the internal item array of this Item3D.
Parameters
- integer index: The index to set within the children array.
- Libraries.Interface.Item3D: The item to store in the given index.
Example
use Libraries.Interface.Item3D
Item3D parentItem
Item3D child1
Item3D child2
parentItem:Add(child1)
parentItem:SetItem(0, child2)
SetJointList(Libraries.Game.Physics.Joints.JointEdge3D list)
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).
Parameters
Example
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()
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
- Libraries.Game.Layer3D: The layer to keep a reference to.
SetLinearDamping(number linearDamping)
This action sets the width, height, and depth of the Item3D.
Parameters
- number linearDamping
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(50, 200, 35)
myItem:SetDimensions(vector)
SetLinearVelocity(Libraries.Compute.Vector3 linearVelocity)
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).
Parameters
Example
use Libraries.Interface.Item3D
Item3D myItem
Item3D parentItem
parentItem:SetX(50)
myItem:SetX(25)
parentItem:Add(myItem)
number x = myItem:GetGlobalX()
SetLinearVelocityX(number linearVelocityX)
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.
Parameters
- number linearVelocityX
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetZ(75)
number offset = myItem:GetOffsetZ()
SetLinearVelocityY(number linearVelocityY)
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.
Parameters
- number linearVelocityY
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetY(75)
number offset = myItem:GetOffsetY()
SetLinearVelocityZ(number linearVelocityZ)
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.
Parameters
- number linearVelocityZ
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetX(100)
number offset = myItem:GetOffsetX()
SetMass(number mass)
GetDimensions will return a Vector3 object containing the width, height, and depth of this Item3D object.
Parameters
- number mass
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
myItem:SetWidth(50)
Vector3 vector = myItem:GetDimensions()
SetName(text newName)
This action sets the internal name of the Item.
Parameters
- text newName
Example
use Libraries.Interface.Item
Item item
item:SetName("My Item")
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
- Libraries.Interface.Item: The next Item to receive focus after this one.
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.
Parameters
- Libraries.Compute.Vector3: A Vector3 containing the new x, y, and z offsets.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(75, 40, 35)
myItem:SetOffset(vector)
SetOffset(number xAmount, number yAmount, number zAmount)
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.
Parameters
- number xAmount: The new X offset.
- number yAmount: The new Y offset.
- number zAmount: The new Z offset.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffset(75, 40, 35)
SetOffsetX(number xAmount)
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.
Parameters
- number xAmount: The new X offset.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetX(100)
SetOffsetY(number yAmount)
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.
Parameters
- number yAmount: The new Y offset.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetY(75)
SetOffsetZ(number zAmount)
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.
Parameters
- number zAmount: The new Z offset.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetOffsetZ(75)
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
- Libraries.Interface.Item3D: The parent item.
SetPhysicsProperties(Libraries.Game.Physics.PhysicsProperties3D properties)
SetPosition(Libraries.Compute.Vector3 vector)
This action sets the x, y, and z coordinates of the Item3D.
Parameters
- Libraries.Compute.Vector3: The new position for this Item.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(50, 200, 35)
myItem:SetPosition(vector)
SetPosition(number setX, number setY, number setZ)
This action sets the x, y, and z coordinates of the Item3D.
Parameters
- number setX: The new x coordinate for this Item.
- number setY: The new y coordinate for this Item.
- number setZ: The new z coordinate for this Item.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetPosition(50, 200, 35)
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
- Libraries.Interface.Item: The previous Item to receive focus before this one.
SetProperty(text key, Libraries.Data.Formats.JavaScriptObjectNotation value)
Parameters
SetResponsive()
SetResponsiveness(integer type)
This action sets the width of the Item.
Parameters
- integer type
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetWidth(35.0)
SetRestitution(number restitution)
GetY will return the Y coordinate of this Item3D in 3D space. Note that if if this object 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.
Parameters
- number restitution
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetY(50)
number y = myItem:GetY()
SetRotation(number newYaw, number newPitch, number newRoll)
This action sets the orientation of the 3D object using yaw, pitch, and roll angles in degrees. The yaw describes how far the camera is rotated along the X/Z axis. It effectively controls how the camera turns left and right. A positive value will rotate the camera clockwise (typically to the right). The pitch describes how far the camera is angled up or down. The pitch value should typically be between -90 and 90 degrees. Larger values will cause the camera to look in the opposite direction specified by the yaw value. For pitch values between -90 and 90, positive values angle the camera upwards, and negative values angle it downwards. The roll describes how the top of the camera is oriented. A roll value of 0 will angle the camera so the top of the camera points upward, towards the positive Y axis. A positive roll value "twists" the camera clockwise, and a negative value will twist it counter-clockwise.
Parameters
- number newYaw: The yaw angle, measured in degrees.
- number newPitch: The pitch angle, measured in degrees.
- number newRoll: The roll angle, measured in degrees.
SetRotation(Libraries.Compute.Vector3 rotation)
This action sets the orientation of the 3D object using yaw, pitch, and roll angles set in a Vector3. The yaw describes how far the camera is rotated along the X/Z axis. It effectively controls how the camera turns left and right. A positive value will rotate the camera clockwise (typically to the right). The pitch describes how far the camera is angled up or down. The pitch value should typically be between -90 and 90 degrees. Larger values will cause the camera to look in the opposite direction specified by the yaw value. For pitch values between -90 and 90, positive values angle the camera upwards, and negative values angle it downwards. The roll describes how the top of the camera is oriented. A roll value of 0 will angle the camera so the top of the camera points upward, towards the positive Y axis. A positive roll value "twists" the camera clockwise, and a negative value will twist it counter-clockwise.
Parameters
- Libraries.Compute.Vector3: Vector containing the 3 angles to set the rotation to
SetRotationTransform(Libraries.Compute.Matrix4 source)
This action copies the values of the provided Matrix4 into this item's rotation transform, effectively allowing you to copy rotations from one object to another.
Parameters
- Libraries.Compute.Matrix4: The source rotation matrix to copy into this item.
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Matrix4
Item3D item1
item1:Rotate(1, 0, 1, 45)
Matrix4 rotation = item1:GetRotationTransform()
// Copy the rotation from item1 into a new Item, item2
Item3D item2
item2:SetRotationTransform(rotation)
SetScale(number scaleX, number scaleY, number scaleZ)
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.
Parameters
- number scaleX
- number scaleY
- number scaleZ
Example
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)
SetScale(number scaleX, number scaleY, number scaleZ, boolean scaleChildren)
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.
Parameters
- number scaleX
- number scaleY
- number scaleZ
- boolean scaleChildren
Example
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)
SetScaleX(number scale)
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.
Parameters
- number scale
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:Scale(5, 2, 1, false)
SetScaleX(number scale, boolean scaleChildren)
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.
Parameters
- number scale
- boolean scaleChildren
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:Scale(5, 2, 1)
SetScaleY(number scale, boolean scaleChildren)
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.
Parameters
- number scale
- boolean scaleChildren
Example
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)
SetScaleY(number scale)
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.
Parameters
- number scale
Example
use Libraries.Interface.Item3D
use Libraries.Compute.Vector3
Item3D myItem
Vector3 vector
vector:Set(5, 2, 1)
myItem:Scale(vector)
SetScaleZ(number scale, boolean scaleChildren)
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.
Parameters
- number scale
- boolean scaleChildren
Example
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)
SetScaleZ(number scale)
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.
Parameters
- number scale
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:Rotate(5, 2, 1, 90, false)
SetScreenPositionFromPhysicsPosition()
SetShaderData(Libraries.Language.Object shaderData)
GetRenderables is used to retrieve all of the individual renderable components of this Model. This action is used internally by the Game engine. Most users should never need to access this action directly.
Parameters
SetShaderMapping(Libraries.Game.Graphics.Shaders.ShaderMapping shaderMapping)
CalculateBoundingBox will create a new BoundingBox object that contains the bounds of the Model.
Parameters
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
use Libraries.Game.BoundingBox
class Main is Game
Model cube
action Main
StartGame()
end
action CreateGame
Color mint
mint:SetColor(0.5, 1, 0.75, 1)
cube:LoadBox(2, 2, 2, mint)
Add(cube)
BoundingBox box = cube:CalculateBoundingBox()
output "The dimensions of the bounding box are: " + box:GetWidth() + ", " + box:GetHeight() + ", " + box:GetDepth()
end
end
SetShaderProgram(Libraries.Game.Graphics.Shaders.ShaderProgram shaderProgram)
ExtendBoundingBox will expand the bounds of the given BoundingBox to fully encapsulate the bounds of this Model.
Parameters
Example
use Libraries.Game.Game
use Libraries.Game.Graphics.Model
use Libraries.Game.Graphics.Color
use Libraries.Game.BoundingBox
class Main is Game
Model cube
Model cylinder
action Main
StartGame()
end
action CreateGame
Color blue
blue:SetColor(0, 0, 1, 1)
cube:LoadBox(2, 2, 2, blue)
Add(cube)
cylinder:LoadCylinder(1, 4, 1, blue)
Add(cylinder)
BoundingBox box = cube:CalculateBoundingBox()
cylinder:ExtendBoundingBox(box)
output "The dimensions of the bounding box are: " + box:GetWidth() + ", " + box:GetHeight() + ", " + box:GetDepth()
end
end
SetShape(Libraries.Game.Collision.Shapes.CollisionShape3D shape)
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.
Parameters
Example
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)
SetSleepTime(number time)
Parameters
- number time
SetTimeOfImpact(number timeOfImpact)
matrix:row2column2 = tempMatrix:row2column2// * vector:GetZ()
Parameters
- number timeOfImpact
SetTorque(Libraries.Compute.Vector3 torque)
transform:Translate(vector:GetX(), vector:GetY(), vector:GetZ() * -1)
Parameters
SetUnmovable()
SetWidth(number setWidth)
This action sets the width of the Item.
Parameters
- number setWidth: The new width.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetWidth(35.0)
SetX(number setX)
This action sets the X coordinate of the Item.
Parameters
- number setX: The new x coordinate for this Item.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetX(35.0)
SetY(number setY)
This action sets the Y coordinate of the Item.
Parameters
- number setY: The new y coordinate for this Item.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetY(210.0)
SetYawPitchRoll(number yaw, number pitch, number roll)
Vector3 localOffset = child:GetGlobalPosition()
Parameters
- number yaw
- number pitch
- number roll
SetZ(number setZ)
This action sets the Z coordinate of the Item.
Parameters
- number setZ: The new z coordinate for this Item.
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetZ(210.0)
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. 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
use Libraries.Interface.Item
Item item
item:Show()
Simulate(boolean flag)
This action sets the X coordinate of the Item.
Parameters
- boolean flag
Example
use Libraries.Interface.Item3D
Item3D myItem
myItem:SetX(35.0)
SynchronizeNodes()
This action returns the current Layer3D that this Item3D is a part of in the Game libraries.
Update(number secondsSinceUpdate)
This action updates the item. It takes a number parameter that should indicate how many seconds have passed since the last time this action was called. This action does nothing in the Item class, but any class that inherits from Item may override it.
Parameters
- number secondsSinceUpdate: The number of seconds that have passed since the last time Update was called.
Example
use Libraries.Interface.Item
use Libraries.System.DateTime
class Main is Item
action Main
// We'll use a DateTime object to count seconds.
DateTime time
number currentTime = time:GetEpochTime()
number newTime = 0
repeat while GetX() < 300
// Check what the time is now.
newTime = time:GetEpochTime()
// Calculate how many seconds have passed, then call Update.
Update( (newTime - currentTime)/1000 )
// Store the old time.
currentTime = newTime
end
end
// Our update action will move our Item to the right at 200 units a second.
action Update(number secondsSinceUpdate)
SetX(GetX() + 200 * secondsSinceUpdate)
end
end
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.
Parameters
- number secondsSinceUpdate: The number of seconds that have passed since the last time Update was called.
Example
use Libraries.Interface.Item
Item parentItem
Item child1
Item child2
parentItem:Add(child1)
parentItem:Add(child2)
parentItem:UpdateAll(0)
UpdateInertia()
On this page
Variables TableAction Documentation- Add(Libraries.Interface.Item3D newItem)
- Add(integer index, Libraries.Interface.Item3D newItem)
- AddBehavior(Libraries.Interface.Behaviors.Behavior behavior)
- AddFocusListener(Libraries.Interface.Events.FocusListener listener)
- AddGestureListener(Libraries.Interface.Events.GestureListener listener)
- AddMouseListener(Libraries.Interface.Events.MouseListener listener)
- AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)
- AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)
- AddTouchListener(Libraries.Interface.Events.TouchListener listener)
- ApplyAngularImpulse(Libraries.Compute.Vector3 impulse)
- ApplyDamping(number seconds)
- ApplyForce(Libraries.Compute.Vector3 force, Libraries.Compute.Vector3 point)
- ApplyForceToCenter(Libraries.Compute.Vector3 force)
- ApplyImpulse(Libraries.Compute.Vector3 impulse, Libraries.Compute.Vector3 localPositionToApply)
- ApplyLinearImpulse(Libraries.Compute.Vector3 impulse, Libraries.Compute.Vector3 point)
- ApplyLinearImpulseToCenter(Libraries.Compute.Vector3 impulse)
- ApplyTorque(Libraries.Compute.Vector3 torque)
- ApplyTorqueImpulse(Libraries.Compute.Vector3 torque)
- BeginCollision(Libraries.Interface.Item item)
- CalculateBoundingBox()
- CalculateBoundingBox(Libraries.Game.BoundingBox box)
- CanRotate(boolean flag)
- CancelBehaviors()
- CollideWithChildren()
- Compare(Libraries.Language.Object object)
- 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)
- DestroyNodes(Libraries.Game.Collision.BroadphaseCollision3D broadphase)
- Dispose()
- DisposeAll()
- DisposeChildren()
- Draw(Libraries.Game.Graphics.Painter3D painter)
- Empty()
- EmptyAll()
- EmptyChildren()
- EnablePhysics(boolean flag)
- Equals(Libraries.Language.Object object)
- ExtendBoundingBox(Libraries.Game.BoundingBox box)
- FastMoving(boolean flag)
- FinishCollision(Libraries.Interface.Item item)
- Focus()
- GainedFocus(Libraries.Interface.Events.FocusEvent event)
- GetAccessibilityCode()
- GetAccessibilityRoleDescription()
- GetAccessibilityType()
- GetAccessibleParent()
- GetAngularDamping()
- GetAngularFactor()
- GetAngularVelocity()
- GetAnimations()
- GetAssetFile()
- GetBlueprintKey()
- GetBoundingBox(integer childIndex)
- GetCenterOfMassPosition()
- GetCenterOfMassTransform()
- GetCollisionGroupFlag()
- GetCollisionGroupIndex()
- GetCollisionList()
- GetCollisionTransform()
- GetCollisionTransform0()
- GetColor()
- GetDepth()
- GetDescription()
- GetDimensions()
- GetFocusListeners()
- GetForce()
- GetFriction()
- GetGestureListeners()
- GetGlobalPosition()
- GetGlobalX()
- GetGlobalY()
- GetGlobalZ()
- GetHashCode()
- GetHeight()
- GetInputGroup()
- GetInputTable()
- GetInterpolatedAngularVelocity()
- GetInterpolatedLinearVelocity()
- GetInterpolationTransform()
- GetInterpolationWorldTransform()
- GetInverseInertiaLocal()
- GetInverseInertiaWorld()
- GetInverseMass()
- GetItem(integer index)
- GetItemCount()
- GetItems()
- GetJointList()
- GetLayer()
- GetLights(Libraries.Containers.Array
array) - GetLights()
- GetLinearDamping()
- GetLinearVelocity()
- GetLinearVelocityAtLocalPoint(Libraries.Compute.Vector3 relativePosition)
- GetMass()
- GetMaterials()
- GetModelBlueprint()
- GetModelType()
- GetMouseListeners()
- GetMouseMovementListeners()
- GetMouseWheelListeners()
- GetName()
- GetNextFocus()
- GetNode(integer index)
- GetNodeCount()
- GetNodes()
- GetOffsetX()
- GetOffsetY()
- GetOffsetZ()
- GetOrientation()
- GetParent()
- GetPhysicsProperties()
- GetPitch()
- GetPosition()
- GetPreviousFocus()
- GetPropertiesSize()
- GetProperty(text key)
- GetPropertyKeyIterator()
- GetPushVelocity()
- GetRenderables(Libraries.Containers.Array
renderables) - GetResponsiveness()
- GetRestitution()
- GetRoll()
- GetRotationTransform()
- GetScale()
- GetScaleX()
- GetScaleY()
- GetScaleZ()
- GetScreenBounds()
- GetScreenX()
- GetScreenY()
- GetShaderData()
- GetShaderMapping()
- GetShaderProgram()
- GetShape()
- GetShapeType()
- GetSleepTime()
- GetTimeOfImpact()
- GetTorque()
- GetTouchListeners()
- GetTransform()
- GetTurnVelocity()
- GetWidth()
- GetX()
- GetY()
- GetYaw()
- GetZ()
- HasMoved()
- HasProperties()
- HasProperty(text key)
- Hide()
- IntegrateVelocities(number seconds)
- InternalApplyImpulse(Libraries.Compute.Vector3 linearComponent, Libraries.Compute.Vector3 angularComponent, number impulseMagnitude)
- IsAcceptingMouseInput()
- IsAccessibleParent()
- IsCollidable()
- IsEmpty()
- IsFastMoving()
- IsFocusable()
- IsFocused()
- IsNonResponsive()
- IsOnLayer()
- IsPhysicsEnabled()
- IsResponsive()
- IsRotationAllowed()
- IsShowing()
- IsSimulated()
- IsSimulationRequired()
- IsUnmovable()
- Load(Libraries.Game.Graphics.ModelBlueprint loader, Libraries.Compute.Matrix4 matrix)
- Load(text fileName)
- Load(Libraries.Game.Graphics.ModelBlueprint loader)
- Load(Libraries.System.File file)
- LoadBox(number width, number height, number depth, Libraries.Game.Graphics.Color color)
- LoadBox(number width, number height, number depth, text textureFile)
- LoadBox(number width, number height, number depth, Libraries.Game.Graphics.Drawable drawable)
- LoadBox(number width, number height, number depth, Libraries.System.File textureFile)
- LoadBox(number width, number height, number depth, Libraries.Game.Graphics.Texture texture)
- LoadCylinder(number width, number height, number depth, Libraries.Game.Graphics.Drawable drawable)
- LoadCylinder(number width, number height, number depth, text textureFile)
- LoadCylinder(number width, number height, number depth, Libraries.Game.Graphics.Color color)
- LoadCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Drawable drawable)
- LoadCylinder(number width, number height, number depth, integer divisions, Libraries.System.File textureFile)
- LoadCylinder(number width, number height, number depth, Libraries.System.File textureFile)
- LoadCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Texture texture)
- LoadCylinder(number width, number height, number depth, Libraries.Game.Graphics.Texture texture)
- LoadCylinder(number width, number height, number depth, integer divisions, Libraries.Game.Graphics.Color color)
- LoadCylinder(number width, number height, number depth, integer divisions, text textureFile)
- LoadPlane(number width, number depth, Libraries.Game.Graphics.Texture texture)
- LoadPlane(number width, number depth, text textureFile, boolean doubleSided)
- LoadPlane(number width, number depth, text textureFile)
- LoadPlane(number width, number depth, Libraries.Game.Graphics.Drawable drawable, boolean doubleSided)
- LoadPlane(number width, number depth, Libraries.System.File textureFile)
- LoadPlane(number width, number depth, Libraries.Game.Graphics.Color color, boolean doubleSided)
- LoadPlane(number width, number depth, Libraries.Game.Graphics.Texture texture, boolean doubleSided)
- LoadPlane(number width, number depth, Libraries.Game.Graphics.Color color)
- LoadPlane(number width, number depth, Libraries.Game.Graphics.Drawable drawable)
- LoadPlane(number width, number depth, Libraries.System.File textureFile, boolean doubleSided)
- LoadSphere(number width, number height, number depth, integer horizontalDivisions, integer verticalDivisions, text textureFile)
- LoadSphere(number width, number height, number depth, integer horizontalDivisions, integer verticalDivisions, Libraries.System.File textureFile)
- LoadSphere(number width, number height, number depth, Libraries.Game.Graphics.Color color)
- LoadSphere(number width, number height, number depth, integer horizontalDivisions, integer verticalDivisions, Libraries.Game.Graphics.Color color)
- LoadSphere(number width, number height, number depth, Libraries.System.File textureFile)
- LoadSphere(number width, number height, number depth, integer horizontalDivisions, integer verticalDivisions, Libraries.Game.Graphics.Texture texture)
- LoadSphere(number width, number height, number depth, integer horizontalDivisions, integer verticalDivisions, Libraries.Game.Graphics.Drawable drawable)
- LoadSphere(number width, number height, number depth, Libraries.Game.Graphics.Texture texture)
- LoadSphere(number width, number height, number depth, Libraries.Game.Graphics.Drawable drawable)
- LoadSphere(number width, number height, number depth, text textureFile)
- LostFocus(Libraries.Interface.Events.FocusEvent event)
- Move(Libraries.Compute.Vector3 vector)
- Move(number xAmount, number yAmount, number zAmount)
- MoveX(number xAmount)
- MoveY(number yAmount)
- MoveZ(number zAmount)
- PredictIntegratedTransform(number seconds, Libraries.Game.Collision.PhysicsPosition3D predictedTransform)
- ProceedToTransform(Libraries.Game.Collision.PhysicsPosition3D transform)
- ProcessGestureEvent(Libraries.Interface.Events.GestureEvent event)
- ProcessMouseEvent(Libraries.Interface.Events.MouseEvent event)
- ProcessTouchEvent(Libraries.Interface.Events.TouchEvent event)
- Remove(integer index)
- Remove(Libraries.Interface.Item3D removed)
- RemoveFocusListener(Libraries.Interface.Events.FocusListener listener)
- RemoveGestureListener(Libraries.Interface.Events.GestureListener listener)
- RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)
- RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)
- RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)
- RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)
- RequireSimulation(boolean flag)
- ResetMass()
- ResetScale()
- Rotate(Libraries.Compute.Vector3 vector, number degrees, boolean rotateChildren)
- Rotate(Libraries.Compute.Vector3 vector, number degrees)
- Rotate(number rotateX, number rotateY, number rotateZ, number degrees)
- Rotate(number rotateX, number rotateY, number rotateZ, number degrees, boolean rotateChildren)
- RotateAround(Libraries.Compute.Vector3 point, Libraries.Compute.Vector3 axis, number degrees)
- RotateAround(Libraries.Compute.Vector3 point, Libraries.Compute.Vector3 axis, number degrees, boolean rotateChildren)
- RotateChildren(number rotateX, number rotateY, number rotateZ, number degrees)
- RotateChildren(Libraries.Compute.Vector3 vector, number degrees)
- SaveKinematicState(number time)
- Scale(Libraries.Compute.Vector3 vector)
- Scale(Libraries.Compute.Vector3 vector, boolean scaleChildren)
- Scale(number scaleX, number scaleY, number scaleZ, boolean scaleChildren)
- Scale(number scaleX, number scaleY, number scaleZ)
- SetAcceptsMouseInput(boolean accepts)
- SetAccessibilityCode(integer newAccessibilityCode)
- SetAccessibilityRoleDescription(text newRoleDescription)
- SetAngularDamping(number angularDamping)
- SetAngularVelocity(Libraries.Compute.Vector3 angularVelocity)
- 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)
- SetColor(Libraries.Game.Graphics.Color color)
- SetDepth(number setDepth)
- SetDescription(text newDescription)
- SetDimensions(number setWidth, number setHeight, number setDepth)
- SetDimensions(Libraries.Compute.Vector3 vector)
- SetFocusable(boolean focus)
- SetForce(Libraries.Compute.Vector3 force)
- SetFriction(number friction)
- SetHasMoved(boolean flag)
- SetHeight(number setHeight)
- SetInputGroup(text group)
- SetInterpolatedAngularVelocity(Libraries.Compute.Vector3 velocity)
- SetInterpolatedLinearVelocity(Libraries.Compute.Vector3 velocity)
- SetInterpolationTransform(Libraries.Game.Collision.PhysicsPosition3D transform)
- SetItem(integer index, Libraries.Interface.Item3D newItem)
- SetJointList(Libraries.Game.Physics.Joints.JointEdge3D list)
- SetLayer(Libraries.Game.Layer3D parentLayer)
- SetLinearDamping(number linearDamping)
- SetLinearVelocity(Libraries.Compute.Vector3 linearVelocity)
- SetLinearVelocityX(number linearVelocityX)
- SetLinearVelocityY(number linearVelocityY)
- SetLinearVelocityZ(number linearVelocityZ)
- SetMass(number mass)
- SetName(text newName)
- SetNextFocus(Libraries.Interface.Item next)
- SetNonResponsive()
- SetOffset(Libraries.Compute.Vector3 vector)
- SetOffset(number xAmount, number yAmount, number zAmount)
- SetOffsetX(number xAmount)
- SetOffsetY(number yAmount)
- SetOffsetZ(number zAmount)
- SetParent(Libraries.Interface.Item3D newItem)
- SetPhysicsProperties(Libraries.Game.Physics.PhysicsProperties3D properties)
- SetPosition(Libraries.Compute.Vector3 vector)
- SetPosition(number setX, number setY, number setZ)
- SetPreviousFocus(Libraries.Interface.Item previous)
- SetProperty(text key, Libraries.Data.Formats.JavaScriptObjectNotation value)
- SetResponsive()
- SetResponsiveness(integer type)
- SetRestitution(number restitution)
- SetRotation(number newYaw, number newPitch, number newRoll)
- SetRotation(Libraries.Compute.Vector3 rotation)
- SetRotationTransform(Libraries.Compute.Matrix4 source)
- SetScale(number scaleX, number scaleY, number scaleZ)
- SetScale(number scaleX, number scaleY, number scaleZ, boolean scaleChildren)
- SetScaleX(number scale)
- SetScaleX(number scale, boolean scaleChildren)
- SetScaleY(number scale, boolean scaleChildren)
- SetScaleY(number scale)
- SetScaleZ(number scale, boolean scaleChildren)
- SetScaleZ(number scale)
- SetScreenPositionFromPhysicsPosition()
- SetShaderData(Libraries.Language.Object shaderData)
- SetShaderMapping(Libraries.Game.Graphics.Shaders.ShaderMapping shaderMapping)
- SetShaderProgram(Libraries.Game.Graphics.Shaders.ShaderProgram shaderProgram)
- SetShape(Libraries.Game.Collision.Shapes.CollisionShape3D shape)
- SetSleepTime(number time)
- SetTimeOfImpact(number timeOfImpact)
- SetTorque(Libraries.Compute.Vector3 torque)
- SetUnmovable()
- SetWidth(number setWidth)
- SetX(number setX)
- SetY(number setY)
- SetYawPitchRoll(number yaw, number pitch, number roll)
- SetZ(number setZ)
- ShouldCollide(Libraries.Interface.Item3D otherItem)
- Show()
- Simulate(boolean flag)
- SynchronizeNodes()
- Update(number secondsSinceUpdate)
- UpdateAll(number secondsSinceUpdate)
- UpdateInertia()