- Home /
Question by
sanderbos24 · Mar 22, 2017 at 07:21 AM ·
c#raycastvrcontrollergoogle
Google Daydream Controller pick up objects
Hi Everyone,
I'm stuck with the Google Daydream Controller. I want to pick up an object when I press the AppButton. I tried several tutorials (https://www.youtube.com/watch?v=gllyvcrB69I) but it doesn't work. I can't find a tut for Daydream. Although i look at the Gvr references, i get confused what classes and functions to use to make it work.
I can get the rotation the same as the controller and i thought parenting the object to the Daydream controller would work, but it's not...
Can somebody explain how to pick something up using the Daydream Controller?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ClickChangeColor : MonoBehaviour {
GameObject otherGameObject;
//Vector3 v = GvrController.Orientation * Vector3.forward;
// Use this for initialization
void Start () {
otherGameObject = GameObject.FindWithTag ("Pickup");
}
// Update is called once per frame
void Update () {
if (GvrController.AppButton) {
gameObject.transform.localRotation = GvrController.Orientation;
//gameObject.transform.SetParent(Transform );
gameObject.transform.parent = otherGameObject.transform;
}
}
}
Comment