Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 MadMenyo · Jan 20, 2015 at 04:24 PM · cameratranslate

Camera drifting away when only rotating?

I have this script attached to the camera:

 void Update () {
     transform.LookAt(Vector3.zero);
     transform.Translate(Vector3.right * Time.smoothDeltaTime);
 }

But when the game runs really long the camera is further away. I noticed this yesterday when I had a test build running in the background. The object it was rotating around got really "small". Today I went AFK for a couple of hours and it was even smaller.

I guess it is because I actually move the camera on it's local axis and since it has a lookAt target this axis changes. But it is not rotating 100% correctly. It is not causing real problems but is there a fix to it?

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

$$anonymous$$aybe parent the camera to an empty at the location you are rotating around? Then just rotate the empty itself!

1 Reply

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

Answer by Berenger · Jan 20, 2015 at 04:35 PM

If you wan't the camera to rotate around a point, you could, amongst other possibilities, set the position with trigo :

 transform.position = point + new Vector3( Mathf.Sin(Time.smoothDeltaTime * speed) * distance, height, Mathf.Cos(Time.smoothDeltaTime * speed) * distance);

Then tweak speed, distance and height to get it right.

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 housayyn_r · Sep 14, 2021 at 07:19 PM 0
Share

i dont get what point is. is it a vector3 or a transform?

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

27 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

How to translate a camera forward and back(basically a zoom) according to the distance of two objects? 1 Answer

How can I move a camera on Android with a virtual button press - smoothly? 0 Answers

[Solved] Translating Camera on only X, Z axis on World Space, no matter what is the rotation 0 Answers

Use lookAt and transform.translate at the same time 1 Answer

Object blur on camera moving fast 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