-
Notifications
You must be signed in to change notification settings - Fork 2
Working with GameObjects
mika edited this page Dec 22, 2017
·
1 revision
- void ClearObjects()
- erases all LUA generated objects
- this gets called when switching modes or photospheres
- void AddEvent(string target, string eventType, string functionName)
- attaches event script to target gameobject
- note: You must add AddGazeTarget() first, otherwise event function does not get registered
- void AddEvent(string target, string eventType, string functionName, string parameter)
- attaches event script to target gameobject with parameter to send for that function
- void RemoveEvent(string target, string eventType)
- removes specific event from gameobject
- void SetLayer(string target, string layer)
- sets object layer
- for now, adding AddGazeTarget() automatically also sets correct layer "UI", so that gaze hits it
- void AddGazeTarget(string target)
- makes object as a gaze target
- Collider is required on the object
- void AddDragTarget(string target)
- makes object draggable by adding GazeTargetEmpty script to it (same way like duck)
- note: layer must be also set with: b:SetLayer(id,"Pickable")
- void AddDragTarget(string target, string onStartDragFunction, string onReleaseFunction)
- makes object draggable by adding GazeTargetEmpty script to it (same way like duck)
- also adds lua scripts to run when dragging starts and ends
- void RemoveDragTarget(string target)
- removes GazeTargetEmpty from the object
- void RemoveGazeTarget(string target)
- removes gazetarget script
- void SetColor(string target, int red, int green, int blue)
- sets object material (note: for now only first object, not multimesh)
- void AddRigidbody(string target, float mass)
- adds physics to object (so by default, the object would fall down with gravity)
- void SetVelocity(string target, float x, float y, float z)
- sets physics object velocity
- void AddCollider(string target, string type)
- adds collider to object
- available collider types: "SPHERE", "BOX", "MESH"
- NOTE: if there is not meshfilter in the root gameobject, box collider is added instead (and fit to child objects)
- void AddBoxCollider(string target, float cx, float cy, float cz, float width, float height, float depth)
- Adds box collider with params
- collider center: cx,cy,xz (in gameobject local space)
- collider size: width, height, depth (in gameobject local space)
- void RemoveCollider(string target)
- removes collider from target
- note: only removes first one (not all, if there are multiple same colliders)
- colliders checked: SphereCollider, MeshCollider, BoxCollider, CapsuleCollider
- void SetActive(string target, bool state)
- activate/deactivate gameobject
- when deactivated, it wont interact with anything and scripts attached to the gameobject wont run
- void Rename(string target, string newName)
- renames gameobject
- void SetParent(string child, string parent)
- set parent for this child gameobject (child becomes parented under parent)