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 Gnossen · Dec 08, 2012 at 08:12 AM · cameraplatformerturncorner

Turning a Corner in 2.5d Platformer

So, I decided to give Unity a shot and I've run into my first major hurdle. Right now, I have a basic 2.5d platformer, but I'd like to be able to turn a corner and have the camera follow.

My first idea was to have a global vector that would decide along which axis the character would move as well as which way the camera should point from and it would be updated by individual scripts on each platform which would define which axis should be used when the character is over it.

Then, I decided that it would probably be much more efficient if I didn't have to add a script for each and every platform (there are sure to be many). So, I thought that it might be possible to define regions within which the global vector should have a certain value. Finally, I realized that since I'm still just a beginner with Unity, there's probably something I'm missing that would make the process a whole lot less convoluted. Any ideas?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Philipp · Dec 08, 2012 at 09:15 AM

There are probably many viable ways of doing something like that, but I'd try the following:

Set up your different regions as GameObjects with BoxColliders set as triggers. Rotate these GameObjects so that their x- and y-axes are aligned with how the player would move within the region. When the player enters a region, store the region GameObject she's in. When the player moves, move her along the right and up axes of the region's Transform.

You could also push/pop regions onto a stack when the player enters/exists, so you can create small sub-regions with different move directions.

As for the camera, give it a z-offset, parent it to an empty GameObject and move that GameObject with the player. You could then rotate this parent object to always have the same y-euler angle as the region the player is in, thereby having it point in the right direction.

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

10 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

Related Questions

2.5D Platformer Camera 1 Answer

Rotate Camera 1 Answer

3d platforming Camera 1 Answer

using left right keys to turn 1 Answer

Rotate camera with player 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