Instance
Instance class is a base class which is used by the 3D Models!
- Properties
position
The position property holds a Vector3 value. It is used to define the virtual 3D position of a object.
collisions
The property holds a bool value. It is used to define if other bodies could collide with the object.
scale
The property holds a Vector3 value. It is used to define the virtual 3D scale of a object.
rotation
The property holds a Vector3 value. It is used to define the virtual 3D rotation of a object.
color
The property holds a Color value. It is used to define the virtual 3D color of a object.
- Functions
FindFirstChild(string objectName)
The FindFirstChild function takes in name of the object you want to get. Example usage:
printl(Map:FindFirstChild("Cube").name)
IsA()
The IsA function takes no parameters and returns a string with the class name. Example usage:
if Map["Cube"]:IsA() == "Instance" then
printl("its a instance!")
end
GetAs(string as, string objectName)
The GetAs function takes 2 parameters and then returns the object as the class of as. Example usage:
-- Cubern currently does not support getting values like boolvalue as: Map["BoolValue"] so this comes in handy!
Map:GetAs("BoolValue", "BoolValue")
Connect(string signalName, string ScriptName, string function)
The Connect function takes 3 parameters and then fires when the signalName is emitted. A example usage will make it very easy to understand:
-- Define a function
function onTouch(body)
printl(body.name)
end
Map["Cube"]:Connect("Touched", _SCRIPT, "onTouch") -- just like this we have _SCRIPT which will return script name!
-- it will print body name when a cube is touched by engine calling `onTouch`
Destroy()
The Destroy function just deletes a object from the world.