Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by MDarkwing · Apr 04, 2014 at 10:20 PM · touchraycastingoverlap

Casting a ray when using overlayed cameras (orto and perspt) for GUI and game?

Okay so the basic problem I'm having and i can't seem to google the right answer is this.

Until now i was making GUI by making all of its elements child of MainCamera. It works and im used to it but I wanted to try out the second way to do it thats it with two cameras.

I managed to find out how to set the cameras to display my GUI and the problem is following:

On touch (since this is mobile project) i cast a ray to check if i have hitted a button (button is quad with box collider and a respective tag, example start button is BTNStart) but raycasting doesnt seem to hit any colliders that are in the second camera which handles GUI. I thought that changing the camera to perspective will solve this alas nothing happened. So thats a bump for me. Anyone having any ideas or suggestions?

Thanks in advance

Comment
Add comment · Show 1
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 robertbu · Apr 15, 2014 at 03:48 PM 0
Share

You should enter your 'Edit' as an answer and mark it answered (click on the checkmark).

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer Wiki

Answer by MDarkwing · Apr 15, 2014 at 08:19 PM

EDIT: I've finally solved the problem. You need to cast the ray from the camera which you want to hit. Example you have GUI with some quads as buttons and GUICamera that renders them and you want to cast a ray and dettect "button hit" you have to specify that camera when casting ray aka store it in some variable then cast perform a ray cast from it (pseudo code: GUICam.Raycast(...)) Hope this helps some1 out there

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

21 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

Related Questions

Raycast2D with touch in perspective camera. 1 Answer

How would I shoot out a ray where the mouse is clicked and check for collision in 2D. 1 Answer

Ray Casting iOS 0 Answers

Multiple hit detection with Raycasting? 2 Answers

About Touch Based movement and some other minors doubts. 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