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 missypooh · Mar 25, 2012 at 12:32 PM · scriptingbasicsminimap

Zoom in and zoom out of minimap

I have create a minimap for my games. But it is too small. It is possible that i can zoom in the minimap to have clear view. Like creating some button to zoom in and zoom out of the minimap??

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

5 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by skyfly200-2 · Mar 27, 2012 at 01:42 AM

Yes, you can change the orthographic camera size (sort of the radius of the cameras view). Do this in a script attached to a GUI with buttons. I'm trying to do exactly the same thing, but I do not know how to script that yet (I'm trying to using Antares Universe visual scripting). Ill post again if I find out more.

Here is a link to the documentation for the camera component and the orthographic size value.

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 rutter · Mar 27, 2012 at 01:42 AM

Of course. Presumably you're rendering the minimap with a camera of some sort? If it's an orthographic camera, you can increase its `orthographicSize`; if not, you can decrease its `fieldOfView`.

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 skyfly200-2 · Mar 27, 2012 at 03:35 AM

Here is a script to set the size of an orthographic minimap

If you change the global variable nSize with a button, the camera this script is attached to will scale on any update to the value!

 //  attach this script to a orthographic camera to set the size to the nSize variable
     static var nSize;
     function start () {
         GameObject.orthographic = true;
     //  value to set size is global so it can be set from another script
         nSize = 40;
         GameObject.orthographicSize = nSize;
     }
     
     function Update () {
         if(!GameObject.orthographic)
         GameObject.orthographic = true;
         if(GameObject.orthographicSize != nSize)
         {
     //  filter min and max size/zoom limits
             if(GameObject.orthographicSize > 100)//min
             nSize = 100;//min
             if(GameObject.orthographicSize > 1000)//max
             nSize = 1000;//max
     //  set value
             GameObject.orthographicSize = nSize;
         }
     }
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 missypooh · Mar 27, 2012 at 12:13 PM 0
Share

thank you for the awesome reply. But how come i will get this error??

Assets/Scripts/cameraFollow.js(119,23): BCE0019: 'orthographicSize' is not a member of 'UnityEngine.GameObject'.

avatar image fafase · Mar 27, 2012 at 12:55 PM 0
Share

try changing all the GameObject with camera.

avatar image skyfly200-2 · Mar 27, 2012 at 05:53 PM 0
Share

ohh yeah thx

avatar image skyfly200-2 · Mar 27, 2012 at 06:03 PM 0
Share

now i get this error

Assets/$$anonymous$$ini$$anonymous$$ap Controls/$$anonymous$$ini$$anonymous$$apSizer.js(22,24): BCE0020: An instance of type 'UnityEngine.Camera' is required to access non static member 'orthographicSize'.

avatar image
0

Answer by skyfly200-2 · Mar 27, 2012 at 08:22 PM

here is the package; it has scripts for a slider controlling an orthographic cameras size. Download it here

No extra Scripting required (except to change sliders position from top right corner) Variables changeable in Inspector:

  • Zoom Level starting point value

  • Padding horizontally and vertically(from the top right corner)

  • Slider length

  • Min and Max values of zoom

to setup:

  1. add "MiniMapSizer.js" to your mini map orthographic camera

  2. drag your minimap camera from the hierarchy, onto the cam value of its component

  3. add "MiniMapControl.js" to you main camera

  4. drag your minimap camera from the hierarchy, onto the target value of its component

  5. the settings of the slider are in the "minimapcontrol.js" component of your main camera

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 missypooh · Mar 28, 2012 at 01:03 AM 0
Share

hello. thank you for the awesome script.. :)

avatar image
0

Answer by williampigmeu · Jul 31, 2012 at 02:06 AM

Use this script, I made it for my game:

// Minimap Zoom Script // Author: WilliamPigmeu

// Attach this to a blank GameObject and configure the variables in the Inspector

var minimapZoom = 2; var maxZoom = 7; var minZoom = 14;

var Minimap: Camera;

function Start(){ Minimap.orthographicSize = minimapZoom; }

function Update(){ if (Input.GetKey(KeyCode.KeypadPlus)) if (Minimap.orthographicSize < maxZoom) Minimap.orthographicSize = maxZoom; else minimapZoom -= 1; else if (Input.GetKey(KeyCode.KeypadMinus)) if (Minimap.orthographicSize > minZoom) Minimap.orthographicSize = minZoom; else minimapZoom += 1;

if(Minimap.orthographicSize != minimapZoom) { Minimap.orthographicSize = minimapZoom; } }

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Creating & accessing a function from a diffrent "OnTriggerEnter" Function 1 Answer

Setting Scroll View Width GUILayout 1 Answer

Very simple script - why isn't it working? 1 Answer

Can someone help me fix my Javascript for Flickering Light? 6 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