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 aleem.razzaq09 · Dec 24, 2013 at 07:23 AM · 2dunity4.3

Which Camera projection should I use for 2D game in Unity 4.3

Hi, I am new bee in Unity 3d, and I want to know that which camera projection should I use? When I set this to perspective its has broad view and when I set this to Orthogonal it has rectangle shape camera, So I am bit confuse that which Camera projection use, I also googled but couldn't find any clear hint that which Projection should I use when developing 2D game?

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 Owen-Reynolds · Dec 27, 2013 at 03:13 PM 0
Share

Unity is just copying camera types that have been around for a long time (Orthographic and perspective.) Unity purposely has them work "the same way" as everyone else does.

This means Unity doesn't bother explaining them too much. For a good explanation, just do a general web search. Whatever you find, will 95% apply to Unity.

3 Replies

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

Answer by Spinnernicholas · Dec 27, 2013 at 06:19 PM

Perspective Camera will work just fine. Use the Sprite Renderer's Order in Layer Property to set the rendering order of your sprites.

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
2

Answer by chirhotec · Dec 24, 2013 at 07:53 AM

This is probably a question that is better off in the forums, as its answer is subjective and open for the discussion. But to give a brief solution....

It depends on what you are trying to do :D

If you plan to do sprite based stuff, orthogonal is the way to go. And actually, if you set up your project to use the 2D settings (either on project create, or at Edit > Project Settings > Editor > Default Behavior Mode), it should automatically set the imported camera to orthographic.

If you are doing a "2.5D" game (2D gameplay, 3D assets), and want the subtle perspectives when moving past objects, then you may want to use a perspective camera. See, for example, Donkey Kong Country Returns.

In the past, some folks have also used perspective projection with sprites, to create a parallax effect with background images, but this can cause your sprites to appear less crisp. You could also achieve the same effects with an orthographic camera and some scripting. (not sure if 4.3 has any built in tools to directly solve this problem. See the 2D gameplay demo in the asset store).

Comment
Add comment · Show 5 · 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 Owen-Reynolds · Dec 24, 2013 at 03:41 PM 0
Share

...and for the Perspective camera, increase the distance and drop the field of view. As you get further back (and have a smaller angle to see the same area) the camera gets more and more orthogonally. For 3D objects, this gives a tiny bit of perspective.

Can eyeball the numbers, but the exact equation is camDist = gameWidth/sin(FieldOfView)

avatar image aleem.razzaq09 · Dec 26, 2013 at 10:23 AM 0
Share

@Owen Reynolds Thanks for answering. I am getting bit confuse about camera view angle. I have road sprite image and car sprite image. Road image is quite long and what I am doing I am running car with camera onto this road image. When camera and car reached to the middle of road car hide for split second and then show I also change image but same result. I tested and analyze few hits and find that car hide due to camera angle because when it hide it can be show by other camera angle. I don't know how to tackle with this and I am stuck over here. $$anonymous$$indly help me on this. Thanks in advance.

avatar image Owen-Reynolds · Dec 27, 2013 at 01:46 AM 0
Share

The type of camera shouldn't have anything to do with "popping."

Say you want the camera to see an area 20 meters wide, and you use x&y for the game. An orthogonal camera would just set a width of 20 and angle of 0. It won't matter how far back it is (the amount of -z.) It always sees 20 wide.

If you want a regular camera with a small angle, you still aim at angle 000. But you have to pick to correct -z and angle to get 20 meters wide.

But either way, you still slide the camera around (maybe) on x&y and always get 20 meters on the screen.

avatar image chirhotec · Dec 27, 2013 at 02:01 AM 0
Share

aleem, are you having that problem with a perspective or orthographic projection?

If orthographic, I'm not really sure what the issue is. maybe that the car and the road are on the same sorting layer, and are therefore fighting with other for which to be drawn first.

If you are using a perspective camera, its likely that the road's center point becomes closer to the camera than the car's center point. Since the road is therefore "closer" than the car its drawn on top.

You should really watch some of the documentation videos on Unity's new 2D system: http://www.youtube.com/watch?v=B1F6fi04qw8 http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-overview v=4qE8cuHI93chttp://unity3d.com/learn/tutorials/modules/beginner/2d/2d-controllers

Apparently they've even taken care of parallax. So, if you are using sprites, there is no reason to use a perspective camera

avatar image aleem.razzaq09 · Dec 27, 2013 at 06:35 AM 0
Share

@chirhotec Thanks for answering, I am using Perspective Camera ins$$anonymous$$d of Orthographic, because orthographic remain on single angle and just have width variation. I am new in Unity and don't know when and why use Orthographic and Perspective camera, can you please share with me helping tutorial or any link for this. One thing more the point you are telling about perspective camera "If you are using a perspective camera, its likely that the road's center point becomes closer to the camera than the car's center point. Since the road is therefore "closer" than the car its drawn on top." I am 80% sure this happen because of what you are telling, what will be the solution for this to handle this issue. Thanks again.

avatar image
0

Answer by abuki · Mar 25, 2016 at 11:21 AM

You can use combination of perspective and orthographic camera. Check my article: http://gamasutra.com/blogs/MichalBerlinger/20160323/268657/Combining_Perspective_and_Orthographic_Camera_for_Parallax_Effect_in_2D_Game.php

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

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

Change object's clone tag after creation. 1 Answer

How to move ball as fast as it pulled back for 2D game in Unity 4.3 0 Answers

2D Car game scene confusion 4 Answers

How to handle camera view for avoiding jerking. 0 Answers

Moving object show jerks in middle of Image. 0 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