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 AeonIxion · Oct 18, 2012 at 12:33 PM · orthographicperspectiveoverlay

orthographic and perspective camera overlay

Hello,

I currently have 2 cameras; 1 perspective and 1 orthographic. I made a script that lets the user draw on the screen. I have zero experience with cameras so it's really hard to explain :\ My problem: When I draw, it draws on the screen of the ortographic camera and not on the perspective one.

visual:

alt text

alt text

code:

    public Camera camera;
         
     // Update is called once per frame
     void Update () 
     {
         var pos = camera.ScreenToWorldPoint(Input.mousePosition);
         print(pos + "--" + Camera.main.ScreenToWorldPoint(Input.mousePosition));
         pos.z = camera.transform.position.z + 5;
         transform.position = Vector3.Lerp(transform.position, pos, Time.deltaTime);
         
     }
     
     void OnMouseDown()
     {
         gameObject.renderer.enabled = true;    
     }



EDIT: So while working on something else, apparently I moved my ortho camera. When I tried drawing again this morning, it worked a lot better than yesterday. I guess it didn't work yesterday because the position of my ortho cam was off. It now looks like this: http://i46.tinypic.com/o5nd3b.png

I have another question though. The lines I draw actually go through the gameobject I have placed in my scene (http://i50.tinypic.com/2uohnk0.png). How can I draw them in front of the objects without changing the z-axis of where they are drawn (because changing z-axis makes the line wider / thinner).

orthographic.png (214.6 kB)
perspective.png (472.6 kB)
Comment
Add comment · Show 5
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 Itinerant · Oct 18, 2012 at 04:02 PM 0
Share

I think we'll need to see your drawing code. I imagine it's tied into the camera somewhere, and so you'll just need to change a reference. Or perhaps it isn't tied to any camera, and so it's just defaulting to the ortho, and so you need to add code to specify.

avatar image zyzyx · Oct 18, 2012 at 04:51 PM 0
Share

I think Itinerant is right. $$anonymous$$y guess is you perform a raycast from the orthogonal camera ins$$anonymous$$d of the perspective one.

avatar image Jessespike · Oct 18, 2012 at 05:21 PM 0
Share

Also make sure the DrawingObject's layer is included the perspective camera's culling mask.

avatar image AeonIxion · Oct 19, 2012 at 06:26 AM 0
Share

I added my code

Zyzyx, you're right. I am using the orthograhpic camera. I tried it with the perspective and when I moved the mouse, it kept saying the position didn't change.

avatar image AeonIxion · Oct 19, 2012 at 07:14 AM 0
Share

I found out what the problem was, I edited my post and added a different question.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Argylelabcoat · Oct 18, 2012 at 06:21 PM

I think you may want to look at the "Culling Mask" for your cameras -- make a layer for the curves you are drawing and place them onto that layer. Then make sure that layer is only checked on your perspective cam's "Culling Mask" and not on your ortho cam.

Comment
Add comment · Show 1 · 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 AeonIxion · Oct 19, 2012 at 06:26 AM 0
Share

Thanks, I'll look into that now.

avatar image
0

Answer by AeonIxion · Oct 19, 2012 at 08:41 AM

Got it. Changed the shader of my material to FX/Flare

Comment
Add comment · Show 1 · 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 AeonIxion · Oct 19, 2012 at 01:11 PM 0
Share

No, I don't. lol

Well..it works, but makes the texture really bright. It worked for the texture I was using earlier, but doesn't for another.

avatar image
0

Answer by Hexkonst · Aug 19, 2014 at 02:24 PM

Change the rendering path to vertexlit.

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

15 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

Related Questions

Android perspective skybox 0 Answers

overlay perspective on orthographic camera 2 Answers

Making a camera semi-orthographic 2 Answers

Using a perspective camera can an object act as if viewed by orthographic camera? 1 Answer

Calculate approximate or same size and position of an 2d sprite(plane) object so it appears the same rendered with orthographic and perspective camera 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