Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Kaztorama · Feb 11, 2016 at 10:17 AM · animatorandroid buildvirtualevent triggeringreality

Why my object only disappears when I trigger its animation from cardboard VR?

I'm testing a gaze input method that is shown here. But in my case I'm making a animation play while I'm looking at an object. I have a cube that I animated in unity and when I gaze at it in the Game tab it plays the animation as expected but after build and run, when I gaze at it with my phone, the cube disappears and after a bit appears again. Today is the second day I try different stuff to find what the problem might be but to no avail. Does anybody have a clue why is this happening? Thanks guys.

 using UnityEngine;
 using System.Collections;
 
 public class StartRide : MonoBehaviour {
 
     // How long to look at Menu Item before taking action
     public float timerDuration = 2f;
 
     // This value will count down from the duration
     private float lookTimer = 0f;
 
     // Is player looking at me?
     private bool isLookedAt = false;
 
     private Animator myAnim;
 
     // Camera path
     private GameObject camPath;
     private Animator camAnim;
 
     // MonoBehaviour Start
     void Start()
     {
         // Get camera path
         camPath = GameObject.FindWithTag("CamPath");
 
         // Get camera animation
         camAnim = camPath.GetComponent<Animator>();
 
         // Get my animation
         myAnim = GetComponent<Animator>();
     }
 
     // MonoBehaviour Update
     void Update()
     {
         // While player is looking at me
         if (isLookedAt)
         {
             // Reduce Timer
             lookTimer += Time.deltaTime;
 
             myAnim.Play("CubeAnim");
 
             if (lookTimer > timerDuration)
             {
                 // Reset timer
                 lookTimer = 0f;
 
                 // Do something
                 Debug.Log("BUTTON HAS BEEN SELECTED!");
                 camAnim.Play("Go");
             }
         }
         else {
             // Reset Timer
             lookTimer = 0f;
         }
     }
 
     // Google Cardboard Gaze
     public void SetGazedAt(bool gazedAt)
     {
         // Set the local bool to the one passed from Event Trigger
         isLookedAt = gazedAt;
     }
 }
 


Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Kaztorama · Feb 15, 2016 at 11:30 PM

OK, I have good news but I'm still clueless why the different behaviors between the editor and the phone (Galaxy S6). I had success by selecting the animation asset, and in the inspector clicking "Generate Root Motion Curves", after that, I ticked "Apply Root Motion" on the object's Animator component. Now the object plays the animation just fine, both in editor and phone (guess I just need to keep studying the editor). I uploaded a package of the project to my dropbox public folder. If anyone wants to take a peek you'll basically find the Cardboard Demo plus a Roller Coaster rail track and two animated objects that trigger the Coaster's ride with two different methods. One (the cube) triggers the animation with the gaze input timer NurFACEGAMES provided in his tutorial, the other (a leaver) triggers the animation with a StateMachineBehaviour class. Here it is: https://www.dropbox.com/s/r97lh1vmvhadotm/003GazeStart.unitypackage?dl=0 Thanks once again. Keep up the good work!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

i have an issue with FusedVR,i really need some help with fused vr 0 Answers

VR Game - No Headset Required - Please Test my Game 0 Answers

HTC Vive ray cast hit in runtime object? 0 Answers

Oculus OVR Player Controller does not enable movement. Assets disappear,Oculus OVR Player Controller not working. Assets disapear while in project 0 Answers

Steam VR Fade camera 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges