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 /
avatar image
0
Question by Teiwaz · May 27, 2013 at 06:14 AM · gui

Adjust a Plane to specific Screen postition (Sync with GUI Elemnt)

Hey there,

so i try to place a Plane as a GUI element So i placed a second Cam. Set the settingt to ortographic and rendered my Plane. Everthing ist good except that the plane and my UI are not synced in Screenspace when i change the Screen.width / height. I have no idee how to archive this. How can i force the plane to be everytime rendered at the same Screen X / Y Position ?

Need i to adjust Cam settings or did i need to change the plane position to a specific screen Position ? What is the simplest / solid way to archive this ?

Thanks & Greetings

Lukas

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
Best Answer

Answer by robertbu · May 27, 2013 at 06:21 AM

There are four coordinates systems in Unity, World, Screen, Viewport and GUI. I'm going to assume you have are using GUI and Rects to output your GUI elements. You can position a 3D world object at a GUI coordinate by 1) Converting that coordinate to a Screen coordinate, and then 2) converting the Screen coordinate to a World coordinate. Note World coordinates are in 3D space, so you have to specify the distance in front of the camera when you do the Screen to World conversion. So if we had a GUI coordinate at (200, 300):

 var v3GUI = Vector3(200,300,0);
 var v3Screen = GUIUtility.GUIToScreenPoint(v3GUI);
 v3Screen.z = 10;  // Picking 10 units in front of the camera
 var v3World = Camera.main.ScreenToWorldPoint(v3Screen);
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 Teiwaz · May 27, 2013 at 11:57 AM 0
Share

Your response wasnt right but you point me in the right direction.

Now i am able to place the Sphere at a specific position in the guy.

v3GUI = new Vector3(Screen.width / 2, 100 ,0); v3GUI.z = 20; v3Screen = GUIUtility.GUIToScreenPoint(v3GUI); transform.position = GameObject.Find("SphereCam").camera.ScreenToWorldPoint(v3GUI);

But when i reduce the size of my preview windows the Sphere is beeing streched / Shrinked. How can i "lock" the size of the Sphere ? I guese i need to Scale it ?

greetings

Lukas

avatar image robertbu · May 27, 2013 at 03:44 PM 0
Share

Nothing here should scale your sphere. Is this a perspective issue?

avatar image Teiwaz · May 27, 2013 at 05:58 PM 0
Share

It is beeing scalled because the ortograpic camara is beeing scalled down. $$anonymous$$y interface is cut ins$$anonymous$$d. So the size of the 3d area is beeing changed.

I can post some screens later.

avatar image robertbu · May 27, 2013 at 05:59 PM 0
Share

You will likely get more and faster responses if you open up this new issue as a new question. We try to keep questions to a single issue.

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

14 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

Related Questions

A node in a childnode? 1 Answer

HorizontalScrollbar not appearing in GUILayout.BeginScrollview C# 3 Answers

3D Button? 1 Answer

GUI.enabled ? 0 Answers

Limit on GUI Components? 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