Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 SelfishGenome · Jul 27, 2015 at 08:47 AM · clampmathf.clampfovfieldofview

Clamping values for camera bounds

Hi, I have what probably boils down to a very simple maths problem. Maths is not currently my strong point though.

I have two sets of values that need to be considered, the cameras field of view, which is clamped between 15 - 30.

And the cameras Y position which needs to be altered based on the field of view to be between 3 - 0 respectively.

So if the field of view is at 15, the cameras y position clamp will need to be 3, if the field of view is 20 the y will need to be 2 and so on up to the field of view of 30 where the y will need to be 0.

How would this be achieved? I think I just need a quick tip on the sort of equation that will cover this.

Thanks in advance.

Comment
Add comment · Show 1
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 SelfishGenome · Jul 27, 2015 at 10:03 AM 0
Share

As I am pressed to get this finished, I have already fixed it another way using the speed of the zoom to alter the 0-3 clamp too.

However if anyone comes across this and is willing to provide a small insight to the sort of equation that would have worked I would be very grateful as I really need to improve my maths skills.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Nido · Jul 28, 2015 at 01:50 PM

 minFov = 15;
 
 maxFov = 30;
  
 fovRange = 15; // max - min
 
 normFov = ((fovRange - currentFov)/15);
 
 newYPos = (normFov * 3) + 3; //(unNormalized) + maxYPos

//With any enigmatic explanation, this is the formula

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 SelfishGenome · Jul 28, 2015 at 08:49 PM 1
Share

Thanks that makes sense. I will likely work that back into the project as a cleaner solution.

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

22 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

Related Questions

Visual debugging a Field of view angle 1 Answer

Strange vibrating when moving camera view 0 Answers

Make my player who uses Character Controller to stop moving in one certain direction once it reaches the borders. 1 Answer

clamp rotation the other way? 1 Answer

Is there a way to set the horizontal field of view of a camera? 3 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