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
2
Question by Kyoumi · Mar 05, 2017 at 03:27 PM · uiraycastcanvasrender texture

Click on Canvas in a render texture

Here is my setup : i got a main canvas, which contains 3 render texture (on raw image). alt text

I want to click on them, and interact with the content display by the render texture

In my case, each side of the cubes are a canvas. Click on buttons on the canvas made him rotate to the left, right, top or bottom to display an other canvas.

Each cube got its own camera. And each camera display only its cube.

3D part

I try to do that because i want to make a particular effect that is not possible to get if i directly display the 3 cubes.

I made basic snapshot, don't know if I made myself clear. Tell me if you need more informations or if you don't understand my problem.

I found this : http://answers.unity3d.com/questions/1018336/is-there-a-way-to-click-on-a-render-texture-to-sel.html It does exactly what I want, but without canvas :(

I tried something with the event system RaycastAll, but that's a mess, I used viewport coordinate to prevent ratio issues between the cameras, but it's quite difficult to display. I'm not even sure if its possible ...

I'm able to know which render texture is under my mouse (that's the easy part), but when i try to send a pointer event through the second camera (according to the right renderTexture and with some maths to adapt the ratio), that's just a mess ...

Tell me if you have some clue or any ideas !

canvas.png (64.9 kB)
camera.png (52.0 kB)
Comment
Add comment · Show 4
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 Glurth · Mar 05, 2017 at 03:35 PM 0
Share

have you tried using "https://docs.unity3d.com/ScriptReference/RaycastHit-textureCoord.html" to get the mouse position passed to your render texture camera?I'd think you could simply scale that value by the camera screen size to get your "second screen" mouse position.

avatar image Kyoumi Glurth · Mar 07, 2017 at 08:36 AM 0
Share

Hi, thanks for the advice. I only use canvas on my scene, so i can't use any physic raycast. I have to use Event system Raycast, which never return a RaycastHit ... (https://docs.unity3d.com/ScriptReference/EventSystems.EventSystem.RaycastAll.html)

I have to put every canvas on a plane and i'll be able to use physic raycast, but that's not the behavior I'm looking for right now ...

avatar image Glurth Kyoumi · Mar 08, 2017 at 06:30 PM 0
Share

You can manually call the physics raycast whenever you want. Even after your event system detects a hit. (though that does seem a bit inefficient, not sure how else to get those texture uv coords)

Not sure how that function I mentioned works with canvases, but it's easy to overlay a canvas with an (un-rendered) quad mesh.

avatar image Kyoumi · Mar 08, 2017 at 03:35 PM 0
Share

$$anonymous$$aybe i can ask another question, easier to understand than my huge post.

Is it possible to make an EventSystem.RaycastAll (https://docs.unity3d.com/ScriptReference/EventSystems.EventSystem.RaycastAll.html), thought a camera that isn't the main one and not displayed on screen.

In fact, i want to create a fake PointerEventData by a second camera, which isn't display or visible (it just render a texture)

0 Replies

· Add your reply
  • Sort: 

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Can't interact with buttons in a UI Canvas in World Space Render Mode. 0 Answers

UI Buttons visible but not clickable when using two canvases. 3 Answers

How to get PointerEventDatas[]? 0 Answers

How to check if the Canvas is infront of an object 1 Answer

How to make a crosshair move with the player 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