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 Igorfm · Dec 01, 2014 at 07:21 AM · cameraplayercamera-movementplayer movementcamera rotate

Camera problem

I am trying to make a 2d game just for fun, I am having some problems with the camera. When I rotate the player the camera rotate too because is child of player, but I want to rotate just the player. Can someone help me with this?

alt text

alt text

gameexample1 - copy.jpg (66.9 kB)
gameexample2 - copy.jpg (58.0 kB)
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
0
Best Answer

Answer by Happy-Zomby · Dec 01, 2014 at 07:44 AM

I would recommend you make the camera a seperate object and then put a script on it so it follows the player. E.g:

 private var heightOffSet : Vector3 = Vector3(0,400,0);    //height offset from player for camera
 private var player : GameObject;            //the main player game object
 
 function Start ()
 {
 player = GameObject.Find("Player");    //find game object player and assign
 }
 
 
 function Update ()
 {
 //follow player position    
 transform.position = player.transform.position + heightOffSet;        //have the camera follow the player based on current height offset
 }


you'll need to play with vector height offset to set it to your needs... angle the camera how you like it and then use this to set the distance - you'll need to use position x y z depending if your game is top down or side view...etc... hope that helps,

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 tanoshimi · Dec 01, 2014 at 07:22 AM

Child objects are positioned relative to their parent. So don't make the camera a child of the player.

Comment
Add comment · Show 1 · 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 Pradeep1040 · Dec 01, 2014 at 07:35 AM 0
Share

Hi Igorfm.Dont use camera as a child of player.if u wanted to do so..then use sprite animation to control player ins$$anonymous$$d of using 3d model or any other method to avoid complexity and to reduce game size..

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Player's movements doesn't match orbital camera 1 Answer

Problem in rotating camera around a moving player 1 Answer

Moving Player Relative to Camera? 1 Answer

3rd Person Orbit Camera in LOCAL Space 0 Answers

Rotate Camera to the object 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