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 Dr_GeoFry · Apr 29, 2012 at 02:53 AM · cameralocation

Camera Stays in the Center

Hi,

Currently, I have a camera set to follow the hero in a 2d game. The current camera focuses on the hero and stays in the center of the screen, but I would like the camera to follow the hero but stay at the bottom of the screen. How would I do that? I have a very simple camera script.

Here is a snippet:

 function Update (){
     transform.eulerAngles = Vector3(0,0,0);
 }

How do I accomplish my goal? Other than the above script, the camera values are the default settings.

Thank you for your assistance.

Comment
Add comment · Show 4
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 dwsarber · Apr 29, 2012 at 05:55 AM 0
Share

Could you clarify what you mean by having the camera "at the bottom of the screen"? The camera essentially "is" the screen, so it's a little unclear as to what you're attempting to do.

avatar image Dr_GeoFry · Apr 29, 2012 at 06:06 AM 0
Share

So, within the frame, I want the hero to stand on his platform on the bottom of the frame. Right now, the hero stands on the platform which is in the center of the frame. Does that make sense?

avatar image dwsarber · Apr 29, 2012 at 06:12 AM 0
Share

Ahh, yes, that helps a great deal. One further question: Is the camera a child object of your Hero in the scene hierarchy?

avatar image Dr_GeoFry · Apr 29, 2012 at 06:22 AM 0
Share

Yes, the camera is a child of the hero. It is connected to the hero via an empty gameObject. So it is Hero>>GameObject>>Camera.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer Wiki

Answer by dwsarber · Apr 29, 2012 at 07:06 AM

If I'm understanding your question and comments correctly, then it seems all you need to do is set the Y position of the camera to some positive value. Assuming the camera object doesn't have a rotation other than the default, setting it to a larger Y position will make the Hero appear where you want in the Viewport (in this case at the bottom). Since the camera is a child of the Hero, it will continue to automatically follow him around, even with this new position.

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 Dr_GeoFry · Apr 29, 2012 at 05:36 PM 0
Share

Are you saying to increase the value of the Y in the Normalized View Port? I can't set it any higher than like 1.0 and I'm not seeing any difference. As for like the y-axis of the camera, that doesn't make sense to me since it will rotate the camera...

avatar image Dr_GeoFry · Apr 29, 2012 at 05:50 PM 0
Share

Additionally, can one camera follow two gameObjects?

avatar image dwsarber · Apr 29, 2012 at 06:52 PM 0
Share

@ the first comment, you want to increase the Y Position value in the Transform component of the camera. It will move it "up" relative to its parent object. The only way it rotates is if you change the Rotation values in the Transform, or its parent object rotates (in the same way).

@ the second comment, each camera will only ever be looking at one object or in one direction at a time. It could be possible to have two objects/directions be the focus, but the camera would have flip back and forth between them.

avatar image Dr_GeoFry · Apr 29, 2012 at 07:20 PM 0
Share

Thanks, man. Very helpful.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

how to request location , camera permission during run time ? 0 Answers

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

Where to put camera orbit around player script? 1 Answer

iPhone tracking distance from computer? 0 Answers

Need to Find Distance Between Mouse Cursor and Object in a 2.5D SideScroller 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