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 Vire · Jun 30, 2012 at 05:46 AM · c#camera3disometric

3D Isometric Camera C# - Center on player?

Hi there,

Some background info here, but if short on time and/or just want the final question, skip to bottom.

I'm very new to Unity, I know most of the basics, though. I've done the 3Dbuzz platformer tutorials, I've done a few others as well. I am a Creature TD with above professional level ability who can create professional film & game quality rigs - this has given me an understanding of programming concepts originating with python. Now I am learning C# within unity, I understand most of the concepts necessary for programming with C# or at least a good basis to start with.

But I'm getting stuck on simple things, I feel like there's too much stuff I don't know that I should know. Is there a resource I'm missing for things like this? :

I am making a 3D isometric game. The camera only ever follows the player around, that is all it has to do. It is point and click and will be using a pathfinding system from the asset store both for moving the player and the AI. I've coded the necessary rays for detecting player clicks and placing them on the X/Z grid.

So the camera: My camera script checks if a main camera exists, if not, it will create one and the camera will have 0, 0, 0 position and rotation, but with an orthographic projection (instead of perspective). The empty object that the camera is parented to will be lifted up on Y, rotated by 30 degrees on X, and 45 degrees on Y to create the isometric view.

------------TLDR & final question -----------

How do I make my isometric camera always have the player centered on the screen? It should spawn centered, and remain centered as the player moves. Even could just parent the camera under the player (kind of a cheap hack) but then I still need him centered to begin with.

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 syclamoth · Jun 30, 2012 at 06:04 AM 0
Share

Just get a reference to the player, and follow its position in 'LateUpdate'. The camera should be the child of a 'pivot' object, which follows the exact location of the player. This way, you can rotate the camera as well, without worrying about keeping track of its position and rotation.

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by whydoidoit · Jun 30, 2012 at 06:04 AM

Well your cheap hack sounds exactly what you need. Especially as the camera is not to move independently then it should be configured this way, anything else would just be costing performance for no reason. Just arrange the camera so the character is in the centre of the view and you are done.

One thing I used when trying to pick up Unity programming was the Most Voted button on Unity Answer's question lists - that shows you things that other people have found important.

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 levent81 · May 15, 2020 at 03:14 AM

Here is my solution:

 void LateUpdate () {
         if (takipEdilecek) {            
             Vector3 kameraYeniPosisyon = takipEdilecek.position - (transform.rotation * Vector3.forward * mesafe);
             transform.position = Vector3.Lerp (transform.position, kameraYeniPosisyon, Time.deltaTime * 2);
         }
     }

takipEdilecek: Object which is followed by cam. kameraYeniPosisyon: Cam's new position. mesafe: Cam's distance to object. (Script is attached to cam)

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

7 People are following this question.

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

Related Questions

Limiting vertical camera rotation 0 Answers

3D camera smooth rotation and mouse wheel zoom 2 Answers

Why is the camera going crazy when the player moves? 0 Answers

Change from 3D to 2D 1 Answer

UNITY 3D: How to make the camera follow the player? Smoothly 2 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