Skip to main content

[Obsolete] SDKGrab

danger

The SDKGrab is Obsolete!

info

SDKGrab inherits from Component

The Lua interface for SDKGrab component. Add this component to any object to make it grabbable. You can access to various events of the component.

Members

Properties

NameDescription
SDKGrab.OnGrabBeginInvokes when the player grabs the object.
SDKGrab.OnGrabEndInvokes when the player releases the object.
SDKGrab.OnTriggerButonInvokes when the player presses the trigger button on their controller while grabbing to the object.
SDKGrab.OnTriggerReleaseEvent handler which gets triggered when the trigger button is released.

Methods

NameDescription
SDKGrab.ForceRelease()Forcefully release the object from player’s hand.

Inherited Members

Inherited Properties

NameDescription
SDKGrab.gameObjectThe game object this component is attached to. A component is always attached to a game object.
SDKGrab.tagThe tag of this game object.
SDKGrab.transformThe Transform attached to this GameObject.
SDKGrab.hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
SDKGrab.nameThe name of the object.

Inherited Methods

NameDescription
SDKGrab.BroadcastMessage(methodName, parameter=nil)Calls the method named methodName on every Lua Script in this game object or any of its children.
SDKGrab.CompareTag(tag)Is this game object tagged with tag ?
SDKGrab.GetAllLuaScripts()Returns an array of all Lua scripts that attached to the game object.
SDKGrab.GetComponent(type)Returns the component of Type type if the game object has one attached, nil if it doesn't.
SDKGrab.GetComponentInChildren(t)Returns the component of Type type in the GameObject or any of its children using depth first search.
SDKGrab.GetComponentInParent(t)Returns the component of Type type in the GameObject or any of its parents.
SDKGrab.GetComponents(type)Returns all components of Type type in the GameObject.
SDKGrab.GetComponentsInChildren(t)Returns all components of Type type in the GameObject or any of its children.
SDKGrab.GetComponentsInParent(t)Returns all components of Type type in the GameObject or any of its parents.
SDKGrab.SendMessage(methodName, value=nil)Calls the method named methodName on every Lua Script in this game object.
SDKGrab.SendMessageUpwards(methodName, value=nil)Calls the method named methodName on every LuaScript in this game object and on every ancestor of the behaviour.
SDKGrab.TryGetComponent(type)Gets the component of the specified type, if it exists.
SDKGrab.GetInstanceID()Returns the instance id of the object.

Example

How to get the component:

do
local script = LUA.script;
local obj = script.gameObject;

local function onFire()
Debug.Log("Bang!");
end

function script.Start()
local grab = obj.GetComponent(SDKGrab);
grab.OnTriggerButon.Add(onFire);
end


end