I need to access the “object” on the OnGrab event. How is this done in the method I call?
Example method, using dynamically created args
private void DoObjectGrab(object sender, InteractableObjectEventArgs e)
{
if (e.interactingObject == controllers.left)
{
holdControl = controllers.left.GetComponent<VRTK_ControllerEvents>();
stringControl = controllers.right.GetComponent<VRTK_ControllerEvents>();
holdActions = controllers.left.GetComponent<VRTK_ControllerActions>();
stringActions = controllers.right.GetComponent<VRTK_ControllerActions>();
}
else
{
stringControl = controllers.left.GetComponent<VRTK_ControllerEvents>();
holdControl = controllers.right.GetComponent<VRTK_ControllerEvents>();
stringActions = controllers.left.GetComponent<VRTK_ControllerActions>();
holdActions = controllers.right.GetComponent<VRTK_ControllerActions>();
}
StartCoroutine("GetBaseRotation");
}