- Home /
Question by
tocu-adrian · Jul 21, 2020 at 02:21 PM ·
collisionvroculus riftcontrollersinteractable
VRTK: Gameobject will not become child
Hi,
I'm working on a virtual reality application and I'm using VRTK for controllers behavior.
When two objects collide, i want that one of them to be automatically released by the vr controller and become the child of the other one.
Here is my code and the problem is the the targeted object will not become child. From my tests it's because of the "interactableObject.ForceStopInteracting();".
Do you have any idea of what's happening and how to fix it ?
private void SetPlaceholderChild(GameObject tablet, GameObject placeholder)
{
VRTK_InteractableObject interactableObject = tablet.GetComponent<VRTK_InteractableObject>();
interactableObject.ForceStopInteracting();
//tablet.transform.SetParent(placeholder.transform);
tablet.transform.parent = placeholder.transform;
}
Comment