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
3
Question by m_truly · Mar 23, 2016 at 08:51 PM · camerasettingscone

Setting to Show Camera Cone Always?

When a camera is selected, it's cone becomes visible in the viewport. When a different camera is selected, it's cone becomes visible and the first camera's cone disappears.

Is there a setting anywhere to show a camera's cone in the viewports all the time?

Thanks!

Comment
Add comment · Show 2
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 toast_sapper · Dec 31, 2016 at 09:40 PM 0
Share

I would also really like to be able to do this, since I otherwise have to awkwardly click the camera, check the field of view, move some other object, then click the camera again to gauge position relative to the camera view.

This makes it especially difficult to position objects out of the camera view with a buffer.

avatar image Glurth · Dec 31, 2016 at 11:02 PM 1
Share

$$anonymous$$ay I suggest you add the word Frustum to your title (technical word for the camera pyramid), for future searchers.

1 Reply

· Add your reply
  • Sort: 
avatar image
5

Answer by Glurth · Dec 31, 2016 at 11:00 PM

I don't know of a way to do this by default.

However, if you add this script to a scene object, and drag over it's single field, the camera you want to see the frustum for, it will ALWAYS draw the frustum (unless you specifically disable the object or script).

 using UnityEngine;

 [ExecuteInEditMode]
 public class FrustumAlways : MonoBehaviour {
     public Camera cameraShowFrustumAlways;
     private void OnDrawGizmos()
     {
         if (cameraShowFrustumAlways)
         {
             Gizmos.matrix = cameraShowFrustumAlways.transform.localToWorldMatrix;
             Gizmos.DrawFrustum(cameraShowFrustumAlways.transform.position, 
                 cameraShowFrustumAlways.fieldOfView, 
                 cameraShowFrustumAlways.farClipPlane, 
                 cameraShowFrustumAlways.nearClipPlane, 
                 cameraShowFrustumAlways.aspect);
         }
     }
 }
Comment
Add comment · Show 8 · 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 Grench1 · Dec 31, 2016 at 11:03 PM 0
Share

Sorry but I have a Network problem, I was making a game but I need to Sync betwen host and client a simple spotlight state (enabled/disabled; intensity; color, etc...) I was surfing the web for hours and found nothing please help!

avatar image Glurth Grench1 · Dec 31, 2016 at 11:06 PM 0
Share

$$anonymous$$ay I suggest you create a new question for that @Grench1 (with lots of details) This question appears unrelated to that.

avatar image Grench1 Glurth · Dec 31, 2016 at 11:07 PM 0
Share

Yea I did yesterday in the morning but stills in moderation :(

Show more comments
avatar image AndreiMarian · May 05, 2017 at 11:40 AM 0
Share

EDIT: Gizmos.DrawFrustum() has a subtle bug, hence the script doesn't work as expected: The "apex" is in fact the near plane center.
Here's the modified script to account for the bug:

 using UnityEngine;
  [ExecuteInEdit$$anonymous$$ode]
  public class FrustumAlways : $$anonymous$$onoBehaviour {
      public Camera cameraShowFrustumAlways;
      private void OnDrawGizmos()
      {
          if (cameraShowFrustumAlways)
          {
              Gizmos.matrix = cameraShowFrustumAlways.transform.localToWorld$$anonymous$$atrix;
              Gizmos.DrawFrustum(new Vector3(0, 0, cameraShowFrustumAlways.nearClipPlane), 
                  cameraShowFrustumAlways.fieldOfView, 
                  cameraShowFrustumAlways.farClipPlane, 
                  cameraShowFrustumAlways.nearClipPlane, 
                  cameraShowFrustumAlways.aspect);
          }
      }
  }

This is so good that Unity should have it built-in. This is why:
Normally how can you "visually aware" move an object in and out of the frustum of a camera? 1. You see it in the game view. But if you have problematic objects like very transparent or too small: 2. you should use the Scene view - it has wireframe plus you can move the objects and you see them while moving ;) So, you align view to camera and see them. But the Scene view, although aligned, doesn't have the very same frustum as the Game view. Plus you can't always view both at the same time: the moving object and the aligned view. The only viable way w/o being ghetto is: 3. You have the frustum always displayed while you move the objects about.

avatar image Glurth AndreiMarian · May 06, 2017 at 04:55 PM 0
Share

"The "apex" is in fact the near plane center." Oh gosh, that's confusing! nice catch.

Hmm, I see you are using a model-space coordinate for the first param, but I used the worldspace.position- was that wrong too (haven't tested it in a while)?

avatar image AndreiMarian Glurth · May 06, 2017 at 08:19 PM 0
Share

Yes :D and the apex is exactly what you and I thought it was (and surely what the coder of the method thought) - it's just the method definition that's flawed.

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

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

Related Questions

How to render severals cameras at differents Frame Rate ? 2 Answers

Android hortographic camera cropping 1 Answer

Implement fog settings independent of the Scene Render settings. 4 Answers

Camera cone 2 Answers

When to use pixel perfect camera in 2D? 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