Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Sajalsh25 · Sep 02, 2016 at 10:29 PM · androidcameraglitchfollow playerjerking

CAMERA FOLLOW MOVING PLAYER PROBLEM ?

Hi there, i am kinda a new to unity so please help me with my problem.

Basically i am working on a game in unity for 2 months and i had this problem from the start, everytime i update my game with some new features i always try to solve this problem but failed many times.

So my problem is MY CAMERA IS NOT FOLLOWING MY (CONSTANT MOVING) PLAYER SMOOTHLY and when i say not smooth i mean glitchy or jerky or you get the idea!

So Please help me, i've tried Update(), LateUpdate(), FixedUpdate(), transform.position, vector3.lerp, vector.smoothDamp, etc.

  1. the camera is not smooth on my android device (MI3)

  2. the camera or the game does'nt lag on my windows, My brother's android phone (Galaxy S4) only on my phone and i know what you might be thinking that my phone is lagging not the game but i played many games on my phone and not a single one lag!

  3. I will give you any info. you want but please guide me to the right path coz this problem is ruining my game and my time.

  4. i will provide the Player Script and the cameraFollow Script of C# in unity.

  5. Have a look and if you can figure out the problem, Please!

PLAYER SCRIPT

     private float gameSpeed;
 public bool dead;
 public bool quitGameNow;

 void Start () 
 {
     gameSpeed = 6.5f;
     dead = GetComponent<PLAYER>();
     quitGameNow = GetComponent<ExitMenu> ();
 }

 void Update() 
 {
     dead = PLAYER.isDead;
     quitGameNow = ExitMenu.quitGame;
     transform.Translate (gameSpeed * Time.deltaTime, 0f, 0f);

     if (dead == true || quitGameNow == true)
     {
         gameSpeed = 0f;
     }

     if (gameSpeed < 9f) 
     {
         gameSpeed += 0.0007f;
     }

 }    

}

CAMERA FOLLOW SCRIPT

      public Transform lookAt;
 private Vector3 offset = new Vector3 (4.5f,0f,-10f);
 public bool activateCam;
 public static bool allowTouch;
 public bool isDead;

 void Start()
 {
     activateCam = GetComponent<PLAYER>();
     isDead = GetComponent<PLAYER>();
 }
 
 void Update()
 {
     activateCam = PLAYER.activateCamera;
     isDead = PLAYER.isDead;
     if (activateCam == true && isDead == false) 
     {
         allowTouch = true;
     }
 }
 
 void LateUpdate()
 {
     Vector3 desiredPosition = lookAt.transform.position + offset;
     if (activateCam == true && isDead == false)  
     {
             transform.position = Vector3.Lerp (transform.position, desiredPosition, 0.2f);
     }
 }

BTW - My player does'nt have a rigidbody attached to it and i am moving the camera after it triggers a object (activate cam) and the bool is set to TRUE. (Static Values)

Any Question about the script and about my game ? i am happy to answer :)

THANKS!

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

0 Replies

· Add your reply
  • Sort: 

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

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

Related Questions

How do I assign MainCamera to a dynamically created primitive? 0 Answers

Cinemachine crashes unity 1 Answer

3D objects appear behind 2D on mobile, but in correct order in editor 1 Answer

When i change the resolution in the game tab does the camera covers that much area only 0 Answers

Android build display bug/glitch ? 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