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 /
This question was closed Jan 27, 2015 at 03:46 PM by unimechanic for the following reason:

Duplicate Question

avatar image
0
Question by Maurdekye · Jan 27, 2015 at 03:46 PM · cameralookatroll

Prevent camera from rolling while looking at object

I have some code here that's supposed to change the perspective of the camera to above the ball as it moves around the plane;

 public Camera playerCamera;
 public Transform attention;
 public GameObject playerBall;

 private float height;
 
 void Start () {
     height = playerCamera.transform.position.y;
 }
 
 void Update () {
     playerCamera.transform.position = playerBall.transform.position + new Vector3(0.0f, height, 0.0f);
     playerCamera.transform.LookAt (attention);
 }

The camera is looking directly down from above the ball in the scene, and the attention transform is the center of the platform. When running the code, the camera rotates around to always be facing up, but I don't want that functionality. I want its local y coordinate to stay the same rotation no matter what, so that the arrow keys always move the ball in the same direction relative to the camera's orientation.

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

  • Sort: 
avatar image
0

Answer by unimechanic · Jan 27, 2015 at 03:46 PM

http://answers.unity3d.com/questions/36255/lookat-to-only-rotate-on-y-axis-how.html

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 Maurdekye · Jan 27, 2015 at 09:04 PM 0
Share

That has nothing to do with my problem. Please don't just post links and expect whatever you link to be the correct answer.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Demons Souls Fall death Camera 1 Answer

Space Combat Simulator - Camera and Thrust/Roll 1 Answer

Having a plane at exactly the far clip of a camera 1 Answer

How to implement lock on with a camera that is not a child of the player object? 1 Answer

FPS animate camera look up/down 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