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 pedram92 · Nov 22, 2016 at 12:18 PM · how

Looking at a Object for 5 Seconds then Teleport

Hi All,

I like to have this function in unity: Look at an Object (e.g. a Cube) and after 5 sec. i should be teleported to another plane. Is this possible? I was searching for anything like this but can´t find it.

Thank you in advance.

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 X10KND · Nov 22, 2016 at 12:45 PM

You can make a bool that check whether you are looking at the object or not. If true, then a countdown starts, at the end of which you teleport.

Something like this :

 bool isLooking = false;
 float countdown = 5;
 
 void Update () {
     isLooking = //Script to check if you are looking
     if(isLooking) {
         countdown -= Time.deltaTime;
     }
     if(!isLooking)  {
         countdown = 5;
     }
     //Teleport if countdown reaches zero
     if(countdown <= 0) {
         transform.position = new Vector3 (/*Teleport position*/);
     }
 }

Let me know if it works.

Comment
Add comment · Show 4 · 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
avatar image pedram92 · Nov 22, 2016 at 01:27 PM 0
Share

Hey, thanks for your reply. If i use your code the object is teleported, but i want to be teleported to another place (Vektor).

Thank you in advance.

avatar image ripane pedram92 · Nov 22, 2016 at 01:43 PM 0
Share

Hi you can copy the code into your GoogleVr main camera or the main camera and get teleported to any point you define in the code after 5 seconds. I think pedram92 wants to know sth about: He is standing on a plane with 2-3 cubes, he is looking on the specific cube for 5 seconds and then he gets teleported to another plane in the scene? For this he needs a script that detects the looking on the cube. On googlevr you have a rectangle asset. How can we do a looking script?

avatar image pedram92 · Nov 22, 2016 at 01:39 PM 0
Share

Let me explain it in detail: I have for example an Cube called "Cube" if i look at this cube for 5 seconds, i want to be teleported to another place. So that it has to be dependend to where i look at the moment where i am going. $$anonymous$$aybe with some if statements...

avatar image X10KND · Nov 23, 2016 at 06:44 AM 0
Share

Another what place? Another position? Another Scene?

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

78 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I need your help for SaveLoad method. 1 Answer

[C#] Enum not working properly 2 Answers

How can I convert a PhotoCaptureFrame byte data into SoftwareBitmap? 0 Answers

Changing sprites of a 2D object in C#, Can't figure it out! 1 Answer

How save playerprefs timer 0 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