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 CodyMoores · Mar 06, 2014 at 08:27 PM · cameraminimap

Mini Map Help

Hey guys. Me again. I am creating this game and I implemented a mini map. It uses a separate camera to go around the map and it follows the main camera. Only problem is, is that when I move or turn my character around, it rotates the map instead of the little character texture. Does anyone know how I can get just the texture to move instead of the whole map? Like a COD Style kinda. Thanks to anyone who helps!

alt text

mini.png (4.2 kB)
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 jakovd · Mar 06, 2014 at 08:44 PM 0
Share

Can't tell you for sure what it is cos I don't know how your scene is set up. Is your main camera attached to your player? $$anonymous$$oving the player moves the main camera which moves your $$anonymous$$i map camera?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by wibble82 · Mar 06, 2014 at 08:42 PM

I suspect the issue is that your camera is a child of your player object? So whenever the player moves, the camera moves with them.

You could fix this 2 ways:

  • make your camera NOT a child of the player, and each frame set its position to be player.transform.position + some offset

  • keep your camera a child of the player, and each frame set its rotation to be a fixed value (probably [90,0,0] if you want it looking down?)

I'd favour the former option, as attaching the camera to the player will give you more headaches down the line (such as player death = camera death!), and won't allow you to do funky effects like smoothing on camera movement and the like!

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 CodyMoores · Mar 06, 2014 at 10:25 PM 0
Share

Could you help me out with that? Heres the $$anonymous$$imap code: (Javascript) Im new at this.

 @script ExecuteInEdit$$anonymous$$ode()
 enum posOnScreen { TopLeft, BottomLeft}
 var placement : posOnScreen = posOnScreen.TopLeft;
 
 var $$anonymous$$imapSize : float = 2.0;
 var offsetX : float = 10.0;
 var offsetY : float = 10.0;
 private var adjustSize : float = 0.0;
 
 
 var borderTexture : Texture;
 var effectTexture : Texture;
 var $$anonymous$$imapCamera : Camera;
 
 
 function Update() { 
     if ($$anonymous$$imapCamera == null) return;
     
     adjustSize = $$anonymous$$athf.RoundToInt(Screen.width/10);
     if(placement == posOnScreen.TopLeft){
         $$anonymous$$imapCamera.pixelRect = new Rect(offsetX, (Screen.height -($$anonymous$$imapSize  * adjustSize)) - offsetY, $$anonymous$$imapSize  * adjustSize, $$anonymous$$imapSize * adjustSize);
     } else if(placement == posOnScreen.BottomLeft){
         $$anonymous$$imapCamera.pixelRect = new Rect(offsetX, offsetY, $$anonymous$$imapSize  * adjustSize, $$anonymous$$imapSize * adjustSize);
     }    
 }
 
 
 function OnGUI(){
     if(borderTexture != null){
         $$anonymous$$imapCamera.Render ();
         if(placement == posOnScreen.TopLeft){
             GUI.DrawTexture(Rect(offsetX, offsetY, $$anonymous$$imapSize  * adjustSize, $$anonymous$$imapSize * adjustSize), effectTexture);
             GUI.DrawTexture(Rect(offsetX, offsetY, $$anonymous$$imapSize  * adjustSize, $$anonymous$$imapSize * adjustSize), borderTexture);
         }
     
         if(placement == posOnScreen.BottomLeft){
             GUI.DrawTexture(Rect(offsetX, (Screen.height -($$anonymous$$imapSize  * adjustSize)) - offsetY, $$anonymous$$imapSize  * adjustSize, $$anonymous$$imapSize * adjustSize), effectTexture);
             GUI.DrawTexture(Rect(offsetX, (Screen.height -($$anonymous$$imapSize  * adjustSize)) - offsetY, $$anonymous$$imapSize  * adjustSize, $$anonymous$$imapSize * adjustSize), borderTexture);
         }    
     }
 }
 
 

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

Creating a 2D mimimap for a 3D car game 1 Answer

Make GUI Text not show on the second camera? 1 Answer

MiniMap with player and object icons 1 Answer

How to make camera position relative to a specific target. 1 Answer

Top Down Camera Much like League of Legends or Age of Empires 1 Answer


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