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 /
avatar image
1
Question by hdtvee · May 08, 2017 at 01:11 PM · cameramenupopup

VR popup menu in front of Camera in Fixed Position/Rotation

What I am looking for is probably fairly simple, but I am new in Unity so I need your help if anyone knows.

I am building a VR app and upon some interaction with objects I want a popup menu to appear in front of the camera and when I look away the popup closes .

I have my popup as a child of main camera which is probably wrong because that way it is attached to where the camera is looking. I fixed this by assigning a variable position = transform.position on Start() and then on Update(), transform.position = position. Yet again if I look down on an object and interact the popup will probably be clipping on the ground. I tried not to have the popup as a Camera child but then I couldn't position it properly in front of the camera when appearing.

Anyone knows the best approach to this? Thanks 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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by hdtvee · Jun 12, 2017 at 09:00 AM

I solved it a few days after I wrote the question altering the transform.position of the popup upon setting it active using this code

transform.position = cameraToAppearInFrontOf.transform.position + (cameraToAppearInFrontOf.transform.forward * distanceFromCamera);

where cameraToAppearInFrontOf and distanceFromCamera are pretty self-explanatory variables and adding an EventTrigger Pointer Exit to set to inactive when gaze away.

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
avatar image
0

Answer by Sir-Gatlin · Jun 07, 2017 at 01:40 PM

So I just did this in my own project to make a menu pop up in front of the camera. The easiest way I have found to accomplish this is to create an empty game object, and put it as a child of the camera and putting the z to like 4 so it will always be right in front of the camera. then on click I change the position and rotation of my menu to the position and rotation of my spawn point.

     public GameObject spawn;
     public GameObject popup;
      
 if (Input.GetMouseButtonDown(0))
             {
                 popup.transform.position = spawn.transform.position;
                 popup.transform.rotation = spawn.transform.rotation;
             }

I'm sure you can do something where you get position of the camera and just add 4 to the z vector, if that would make more sense to you.

for making it go away you will have to use a gaze command and move the menu or use GameObject.SetActive to hide it until its used again.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Create a popup menu at specific location 2 Answers

how to show cursor on specific time? 2 Answers

individual object menu 0 Answers

Changing the camera when clicked on a collider 1 Answer

How to make camera stop moving in pause menu? 1 Answer


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