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 Rappy · Nov 03, 2012 at 10:55 PM · animationcamerarotation

Camera follows rotation. How can I fix it?

So I'm a real beginner in Unity3d. I want to make a snowboard game and to simulate a trick I want to play an animation when I hit "F" while I'm in air. So I made an animation where my player (a cube) rotates 360° and also a script which looks like this: if (jumpCount == true && Input.GetButton("Trick1")){ animation.CrossFade ("trick"); }

So this works but I have one problem: My camera (which is a child of my player) also rotates and I don't want this. How can I fix it? Sorry for my bad english...

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

4 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Anxo · Nov 03, 2012 at 11:47 PM

you can tell the camera in an update fuction

transform.rotation = Quaternion.Euler(Vector3.zero);

that way your camera wont rotate at all

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 Anxo · Nov 03, 2012 at 11:47 PM 0
Share

replace the Vector3.zero with any rotation you like.

avatar image Anxo · Nov 03, 2012 at 11:47 PM 0
Share

or you can make the camera not a child of the charater and jsut have it follow the character ins$$anonymous$$d.

avatar image
0

Answer by Rappy · Nov 04, 2012 at 04:10 PM

This worked! :) (the script didn't unfortunately)

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 Rappy · Nov 04, 2012 at 04:10 PM

"or you can make the camera not a child of the charater and jsut have it follow the character instead."

This worked! :) (the script didn't unfortunately)

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 Anxo · Nov 04, 2012 at 04:43 PM 0
Share

glad it worked out for you, check the question off as answered and god luck.

avatar image
0

Answer by Dexter.Unity · Nov 04, 2012 at 04:54 PM

You can create a new empty object: The player controller (just a point).

You make your player child of the player controller and also the camera. Now you can aim the camera at the player controller (point) and move and rotate your player without the camera following it's rotation or translation.

Then if you want the camera to follow the translation of you character you just make the translations apply on your player conrtoller insted of the player itself.

I hope it helps :)

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 Solivagant · Apr 09, 2014 at 11:22 PM 0
Share

This is the kind of out of the box thinking that I love that Unity brings.

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

12 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

Related Questions

Animating a fly through that ends rotating around something 1 Answer

fbx animation beats script animation? 2 Answers

Camera freezes when in bone hierarchy 1 Answer

Make the player go into the direction I am looking at 0 Answers

Problem with wave like movement when rotating around X and Y axis with mouse input // Please Close/Delete 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