Search Unity

jittering , stuttering movement with static camera

Discussion in 'Scripting' started by unwshd_elend, Apr 29, 2020.

  1. unwshd_elend

    unwshd_elend

    Joined:
    Mar 21, 2019
    Posts:
    23
    hello everyone Im using unity 2019.03f with URP .
    in my scene I have a static camera (cinemachine with no movement) and lots of objects moving toward player with transform.translate.
    the problem is that their movement is so jittery and stuttering even on my pc. I have used time.deltaTime , time.smoothDeltaTime , physic based movements and even moving them with animation but nothing seems to solve the problem. can anyone help?
     
  2. matkoniecz

    matkoniecz

    Joined:
    Feb 23, 2020
    Posts:
    170
    "lots of objects"

    Is problem appearing also with a single object?
     
  3. unwshd_elend

    unwshd_elend

    Joined:
    Mar 21, 2019
    Posts:
    23
    Yes I've tried it with few objects
     
  4. matkoniecz

    matkoniecz

    Joined:
    Feb 23, 2020
    Posts:
    170
    Then hopefully it is not caused by inherent hardware limitations. Now you need to post code, because maybe someone will be able and willing to help but noone will be able to magically guess what kind of specific problem is in your code.

    Project shortened to small example still exhibiting this issues would be the best.
     
  5. unwshd_elend

    unwshd_elend

    Joined:
    Mar 21, 2019
    Posts:
    23
    thanks sir
    my code is simple like this :
    transform.Translate(transform.forward * Time.deltaTime * moveSpeed);

    it also happens with Lerp functions...
     
  6. matkoniecz

    matkoniecz

    Joined:
    Feb 23, 2020
    Posts:
    170
    Simplified (but still runnable) script, not a single line from it. For example, maybe you are calling it in a wrong place?
     
  7. unwshd_elend

    unwshd_elend

    Joined:
    Mar 21, 2019
    Posts:
    23
    its in update method , tried it in other places
     
  8. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Post. Your. Code. I don't understand why some people ask for help but are so reluctant to post code.

    Do you think we're going to steal it? It's broken code, why would we steal it? Not to mention that we've all written whatever you're doing a hundred times.

    Are you worried we're going to think you're a bad programmer? Well I for one already think that (because every good programmer I know knows how to ask for help properly) so you may as well post something that we can tell you how to improve it. Also being bad at something is the first step to being sorta good at something.

    Post your freakin code. Put it in [code ] tags. Remove completely irrelevant bits but if you're unsure about how much to include, include more that you think is necessary.

    (Also, I don't think we've ruled out the possibility of the game just having a low framerate?)
     
    matkoniecz likes this.
  9. matkoniecz

    matkoniecz

    Joined:
    Feb 23, 2020
    Posts:
    170
    No, but at least OP describes attempt to test it with a reduced load. Hard to say anything else without code.
     
  10. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Won't help if they for example have an elaborate background that is the thing bogging down the framerate.
     
  11. unwshd_elend

    unwshd_elend

    Joined:
    Mar 21, 2019
    Posts:
    23
    its kinda weird but I havent seen this kind of attitude in unity forums before :)
    I have no problem with posting the code and i acutally did typed it just there , its the only line of code that is doing the movement and other lines are not even related and if you are kind enough to help me solve this i can upload the whole project for you.
    and no its not about low framerate , its running with 57~60 FPS on mobile devices
     
  12. unwshd_elend

    unwshd_elend

    Joined:
    Mar 21, 2019
    Posts:
    23