public void Awake() { trigger = gameObject.GetComponent <CardboardControlTrigger>(); gaze = gameObject.GetComponent <CardboardControlGaze>(); box = gameObject.GetComponent <CardboardControlBox>(); pointer = gameObject.GetComponent <CardboardControlPointer>(); }
private void CardboardGazeChange(object sender) { // You can grab the data from the sender instead of the CardboardControl object CardboardControlGaze gaze = sender as CardboardControlGaze; // We can access to the object we're looking at // gaze.IsHeld will make sure the gaze.Object() isn't null if (gaze.IsHeld() && gaze.Object().name.Contains("Cube")) { ChangeObjectColor(gaze.Object().name); if (gaze.Object().name == "HighlightCube") { // Highlighting can help identify which objects can be interacted with // The reticle is hidden by default but we already toggled that in the Inspector cardboard.reticle.Highlight(Color.red); } } // We also can access to the last object we looked at // gaze.WasHeld() will make sure the gaze.PreviousObject() isn't null if (gaze.WasHeld() && gaze.PreviousObject().name.Contains("Cube")) { ResetObjectColor(gaze.PreviousObject().name); // Use these to undo reticle hiding and highlighting cardboard.reticle.Show(); cardboard.reticle.ClearHighlight(); } // Be sure to set the Reticle Layer Mask on the CardboardControlManager // to grow the reticle on the objects you want. The default is everything. // Not used here are gaze.Forward(), gaze.Right(), and gaze.Rotation() // which are useful for things like checking the view angle or shooting projectiles }
// Be sure to set the Reticle Layer Mask on the CardboardControlManager // to grow the reticle on the objects you want. The default is everything. //TODO: detect if object is destroyed. Check if current gaze object still exists? private void CardboardGazeChange(object sender) { // You can grab the data from the sender instead of the CardboardControl object gaze = sender as CardboardControlGaze; // We can access to the object we're looking at // gaze.IsHeld will make sure the gaze.Object isn't null if (gaze.IsHeld() && gaze.Object().name.Contains("Asteroid")) { //ChangeObjectColor(gaze.Object().name); // Highlighting can help identify which objects can be interacted with // The pointer is hidden by default but we already toggled that in the inspector //currentObject = gaze.Object(); //InvokeRepeating("TargetExistsCheck", 1, 1); cardboard.reticle.Highlight(Color.red); //autoFireOn = true; } // We also can access to the last object we looked at // gaze.WasHeld will make sure the gaze.PreviousObject isn't null if (gaze.WasHeld() && gaze.PreviousObject().name.Contains("Asteroid")) { //ResetObjectColor(gaze.PreviousObject().name); // Use these to undo pointer hiding and highlighting //cardboard.reticle.Show(); CancelInvoke ("TargetExistsCheck"); autoFireOn = false; cardboard.reticle.ClearHighlight(); } }
public void Awake() { trigger = gameObject.GetComponent<CardboardControlTrigger>(); gaze = gameObject.GetComponent<CardboardControlGaze>(); box = gameObject.GetComponent<CardboardControlBox>(); reticle = gameObject.GetComponent<CardboardControlReticle>(); InstantiateCardboardSDKReticleObject(); }
public void Awake() { trigger = gameObject.GetComponent <CardboardControlTrigger>(); gaze = gameObject.GetComponent <CardboardControlGaze>(); box = gameObject.GetComponent <CardboardControlBox>(); reticle = gameObject.GetComponent <CardboardControlReticle>(); InstantiateCardboardSDKReticleObject(); }
public void Awake() { trigger = gameObject.GetComponent<CardboardControlTrigger>(); gaze = gameObject.GetComponent<CardboardControlGaze>(); box = gameObject.GetComponent<CardboardControlBox>(); reticle = gameObject.GetComponent<CardboardControlReticle>(); FixBrokenBaseSDK(); QuestionableBaseSDKRequirements(); }
private void CardboardStare(object sender) { CardboardControlGaze gaze = sender as CardboardControlGaze; if (gaze.IsHeld() && gaze.Object().name.Contains("Cube")) { // Be sure to hide the cursor when it's not needed cardboard.reticle.Hide(); } }
public void CardboardFocus(object sender) { // For more event-driven code, you can grab the data from the sender CardboardControlGaze gaze = sender as CardboardControlGaze; // gaze.IsHeld will make sure the gaze.Object isn't null if (gaze.IsHeld() && gaze.Object().name.Contains("Cube")) { ChangeObjectColor(gaze.Object().name); } }
private void CardboardFocusChanges(object sender) { CardboardControlGaze gaze = sender as CardboardControlGaze; if (gaze.IsHeld() && gaze.Object() == sphere) { float redOrBlue = Random.value; desiredColor = new Color(redOrBlue, Random.value, 1 - redOrBlue); cardboard.pointer.Show(); cardboard.pointer.ClearHighlight(); } }
public void Awake() { magnet = gameObject.GetComponent <CardboardControlMagnet>(); gaze = gameObject.GetComponent <CardboardControlGaze>(); box = gameObject.GetComponent <CardboardControlBox>(); }
public void Awake() { trigger = gameObject.GetComponent<CardboardControlTrigger>(); gaze = gameObject.GetComponent<CardboardControlGaze>(); box = gameObject.GetComponent<CardboardControlBox>(); }
private void CardboardStare(object sender) { gaze = sender as CardboardControlGaze; if (gaze.IsHeld() && gaze.Object().name.Contains("Asteroid")) { // Be sure to hide the cursor when it's not needed //cardboard.reticle.Hide(); currentObject = gaze.Object(); InvokeRepeating("TargetExistsCheck", 1, 1); lastHit = gaze.Hit (); autoFireOn = true; } }