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 rekkered · Nov 12, 2014 at 11:37 PM · cameramouse-look

How to disable the mouse look on a Top down second camera

I have added a second camera to show a top down map. I parented it to the main camera so it inherits the players movements. I have altered the depth and size of the second camera to show its view in the lower left. How do I disable the mouse look control on the second camera so it remains fixed-looking straight down?

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 MrSoad · Nov 12, 2014 at 10:38 PM 0
Share

You could have it track the first camera position rather than move via parenting. This way it will stay just how you want without any rotation, you can either keep in at the main camera height or add a height offset to the main camera y position when moving it.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by MrSoad · Nov 12, 2014 at 11:33 PM

If your "Main Camera" is still called this, then this script should do what you want (it's in js) :

 #pragma strict
 
 //Object/Script access vars.
 private var oMainCamera : GameObject;
 
 //Transform vars.
 private var tMy_Transform : Transform;
 private var tMain_Cam_Transform : Transform;
 
 //Height Adjustment var.
 private var fMap_Cam_Height_Adjustment : float;
 
 function Awake () {
 
     //Connect to Objects and Scripts.
     oMainCamera = GameObject.Find("Main Camera");
 }
 
 function Start() {
 
     //Initialise vars.
     tMy_Transform = transform;
     tMain_Cam_Transform = oMainCamera.transform;
     
     fMap_Cam_Height_Adjustment = 20f;
 }
 
 function LateUpdate() {
 
     if (oMainCamera != null) {
         tMy_Transform.position = Vector3(tMain_Cam_Transform.position.x, (tMain_Cam_Transform.position.y + fMap_Cam_Height_Adjustment), tMain_Cam_Transform.position.z);
     }
 }


Remember to un-parent you map cam from your main cam for this to work, adjust the height offset to whatever you desire.

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 rekkered · Nov 13, 2014 at 03:59 PM 0
Share

Thanks so much. Pardon my ignorance but where exactly does this script go? Do I add it as a component to the main camera?

avatar image MrSoad · Nov 13, 2014 at 04:07 PM 0
Share

No you place it on your map camera, it will then work out it's own position by reading the $$anonymous$$ain Camera position.

avatar image rekkered · Nov 13, 2014 at 04:41 PM 0
Share

That works beautifully! Thank you very much!

avatar image MrSoad · Nov 13, 2014 at 04:44 PM 0
Share

Yep, sorry it was well past midnight when I wrote this(vote up for you :D ), I will change it in the code above for completeness. Feel free to close this question by accepting my answer :)

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Converted MouseLook from C# to Java problems 2 Answers

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

How to make a mesh into a FirstPerson Character? 2 Answers

Mouse-controlled camera getting stuck. 1 Answer

Can't use camera.main [SOLVED] 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