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 Epic · Aug 28, 2010 at 05:07 PM · cameratopdown

How to posistion a camera?

Is there a way to put the camera above an object (the player) and facing down (Top down view) or do I manually move the camera (cant get a good position)

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by GesterX · Aug 28, 2010 at 05:12 PM

The following script can be used for a top down camera.

//attach a top down camera var fixedPositionObject : Transform; //y value of camera var heightOfObject = 5;

function Update () { //keep camera following player at specified height fixedPositionObject.position = Vector3(

 transform.position.x, 

 heightOfObject, 

 transform.position.z
 );

}

Simply create a new script with the above code and add it to the character you want the camera to follow. You will need to drag the Main Camera on to the Fixed Position Object variable in the inspector and also set the X rotation of the main camera to 90. Finally adjust the Height Of Object variable as desired.

Comment
Add comment · Show 2 · 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 Epic · Aug 28, 2010 at 05:54 PM 0
Share

Hey thanks man!

avatar image GesterX · Aug 28, 2010 at 06:20 PM 0
Share

No Problem. If this answers your question then mark the question as answered so others know your happy.

avatar image
0

Answer by jtbentley · Aug 29, 2010 at 02:04 AM

This is pulled out of an iphone app I've worked on.. I've trimmed a lot of the fat (dynamic zoom, etc). The main difference from the one above is that it also dampens the movement of the camera so its less jerky.

// Camera Stuff var mainCam : Transform; // In case you have more than one camera private var mainCamOffset : Vector3; // Temp variable var mainCamXOffset = -3.0; // Offsets var mainCamYOffset = 10.3; // Offsets var mainCamZOffset = -4.5; // Offsets var mainCamDamp = 5; // How much we dampen it by var camTarget : Transform; // What the camera will follow

function Update() { mainCam.position = Vector3.Lerp (mainCam.position, mainCamOffset, Time.deltaTime * mainCamDamp);

 mainCamOffset = camTarget.position; // Update the camera's ideal position :)

 // Apply the offsets (in case you want to follow in front or behind etc)
 mainCamOffset.x += mainCamXOffset;
 mainCamOffset.y += mainCamYOffset;
 mainCamOffset.z += mainCamZOffset;

}

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

No one has followed this question yet.

Related Questions

Deadfrontier type crosshair 1 Answer

Display 1 No cameras rendering when player collides with enemy 1 Answer

How to: Do a camera that is top Down/Isometric 5 Answers

Change Angle of Top Down Camera 0 Answers

Camera Setup for Top Down Shooters 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