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
0
Question by OshakieGittens61 · Jul 17, 2016 at 08:37 PM · cameragameobjectraycastingfieldofview

FOV that brings gameObjects close

Hey, guys so I'm working a third persion game and I am in need of a script that brings a game object in view up close to the players realization. It should work similarly to radar where on approaching said gameobject it becomes enlarge into view.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by chrstw · Jul 20, 2016 at 02:27 PM

So FOV stands for Field of View angle, and is a Camera Property. Increasing the FOV will make the view frustum wider, making all objects within the frustum appear smaller. Decreasing the FOV will make the view frustum more narrow, making all objects inside appear larger. Actual positions are not affected, only the amount of screen space they get. Increasing the FOV over time makes the camera seem to Zoom Out, and decreasing makes it Zoom In.

If you need a script that brings a 1 of N objects into view in front of the camera you have a couple of different approaches.

1) Move the Camera to look at the object.
One approach here would be to create a desired transform that looks at the object in question from your desired position. Then have a script that interpolates from the main camera transform to the desired, and when done back to the main.

2) Move the object to be viewed by the camera. Find a desired position in front of the Camera, then either clone the object, or move the actual object to that position and restore game state when done.

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

Answer by Glurth · Jul 19, 2016 at 11:42 PM

If you start mucking the the FOV you are going to start getting odd effects, like fish-eye, and tunnel vision. I would recommend you leave your FOV alone, and simply place the object the appropriate DISTANCE in front of the camera. I'm not sure I understand what you mean about "approaching it", do you just want to trigger the "examination" when close enough to the object?

Here is how I would bring the object up close for close viewing:

Use the object's Render component, to get it's "Bounds". (The "bounds" defines a box that encloses the entire object) (https://docs.unity3d.com/ScriptReference/Renderer-bounds.html)

Use the bounds to get the "center" of the object (https://docs.unity3d.com/ScriptReference/Bounds-center.html), and put that point directly in front of the camera. at a distance of about 2.0 times the bounds.size.magnitude. (the "2.0 times" may vary depending on just HOW close you want it, and how oblong the object is)

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

NullReferenceException: Object reference not set to an instance of an object 1 Answer

GUI controlling other game objects 0 Answers

How can a camera activate an animation 2 Answers

What is my camera rendering? 2 Answers

Raycasting depending on viewport 2 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