2D Top Down Follow Camera Stuttering

I am making a top down pixel art game and am using a simple follow script for my camera.

void Update()     {         transform.position = new Vector3(target.transform.position.x, target.transform.position.y, transform.position.z);     } 

However i get this weird stuttering effect while moving around: https://gfycat.com/tintedlightheartedcrayfish

Any way to smooth out the camera movement?

When switching between cinemachine cameras why one of the cameras is keep stuttering for some time?

At the top of a script I have this 3 cameras :

public CinemachineFreeLook standUpCamera; public CinemachineFreeLook closeLookCamera; public CinemachineFreeLook gamePlayCamera; 

Inside Update() when loading a saved game I enable/disable the cameras in this order :

void Update()     {         // When starting a new game         if (sceneName == "Game" &&             MenuController.LoadSceneForSavedGame == false && newGameStart == false)         {               SetCamerasAxisProperties(0);               playerAnimator.Play("Stand Up");             StartCoroutine(StandingUp());               newGameStart = true;         }           // When loading a game (also when continue a game)         if(sceneName == "Game" &&            MenuController.LoadSceneForSavedGame == true && loadingGame == false)         {             newGameStart = true;               Camera.main.GetComponent<CinemachineBrain>().m_DefaultBlend.m_Time = 0.1f;               standUpCamera.enabled = false;             closeLookCamera.enabled = false;             gamePlayCamera.enabled = true;             gamePlayCamera.m_XAxis.m_MaxSpeed = 300f;               Camera.main.GetComponent<CinemachineBrain>().m_DefaultBlend.m_Time = blendingTime;               loadingGame = true;         }     } 

This is where I switch between the cameras :

standUpCamera.enabled = false; closeLookCamera.enabled = false; gamePlayCamera.enabled = true; 

For testing and find the problem if I don’t switch between the cameras the active camera is the standUpCamera and this make the stuttering it’s not the player that stuttering but the camera.

When I switch between the cameras I see that the active camera is the standUpCamera than the gamePlayCamera but it’s taking few seconds before the standUp is enabled false and the gamePlaye become enabled true.

What I tried is to change the blending time :

Camera.main.GetComponent<CinemachineBrain>().m_DefaultBlend.m_Time = 0.1f;   standUpCamera.enabled = false; closeLookCamera.enabled = false; gamePlayCamera.enabled = true; gamePlayCamera.m_XAxis.m_MaxSpeed = 300f;   Camera.main.GetComponent<CinemachineBrain>().m_DefaultBlend.m_Time = blendingTime; 

First I set the blending time to 0 than back to the default (5) But it didn’t help. I tried to set the blending also to 0.1f but it didn’t fix the problem. Still it’s taking few seconds almost 3-4 seconds before the gamePlayCamera become enabled true and the standUpCamera enabled false. or maybe the blending is taking time.

Maybe I didn’t change the blending time as it should be ?

Why when I move the transform closer to the target by dragging it in the editor in the scene view the target start stuttering and moving back?

The script is attached to a transform that move to a target and than when reaching the target the transform become child of the target.

The script is working fine as it is now but if I drag with the mouse in the editor in the scene view the target to the moving transform while the transform is already moving to the target then the transform start stuttering and even moving back a bit like pushed back some forces pushing it back maybe because I’m using lerp in lines 55,56 ? I want to use lerp but maybe it’s making the problem?

Second if I move the target away from the transform instead trying to chase me and reaching me its doing this problems again.

I want that if I’m dragging and make the target closer to the moving transform than just keep the transform moving to the target and become child when they reaching each other and if I drag the target away from the transform make the transform try to chase me reach me and become child too.

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class MoveToTarget : MonoBehaviour {     public enum TransitionState     {         None,         MovingTowards,         Transferring     }      public Transform destinationTransform;     public float speed;     public float lerpTime;     public bool isChild = false;      public AnimationCurve curve = AnimationCurve.EaseInOut(0.0f, 0.0f, 1.0f, 1.0f);     public Transform start;     public Transform end;     public float duration = 10.0f;     private float t;      private Transform originTransform;     private float timer;     private TransitionState state = TransitionState.MovingTowards;     private Vector3 originTrans;      void Start()     {         t = 0.0f;          curve.postWrapMode = WrapMode.PingPong;         originTrans = transform.position;     }      void Update()     {         switch (state)         {             case TransitionState.MovingTowards:                 var v = destinationTransform.position - transform.position;                 if (v.magnitude < 0.001f)                 {                     state = TransitionState.Transferring;                     originTransform = destinationTransform;                     timer = 0;                     return;                 }                 Vector3 moveDir = v.normalized;                 //transform.position += moveDir * speed * Time.deltaTime;                 t += Time.deltaTime;                 float s = t / duration;                 transform.position = Vector3.Lerp(originTrans,                     destinationTransform.position, curve.Evaluate(s));                 break;              case TransitionState.Transferring:                 timer += Time.deltaTime;                 this.transform.position = Vector3.Lerp(originTransform.position, destinationTransform.position, timer);                 if (timer >= 1.0f)                 {                     this.transform.parent = destinationTransform;                     isChild = true;                     state = TransitionState.None;                     this.enabled = false;                     return;                 }                 break;              default:                 this.enabled = false;                 return;         }     } } 

Stuttering when using movetowards in a coroutine

first of all, sorry for my English; I have the following problem with a WebGL project I’m working on: I have an object which I want to zoom out and move to a specific position at the same time, for this, I’ve created a coroutine which is called on click. On my computer, everything works perfectly fine, but whenever I try this function on a not that high-end computer, this coroutine stutters a bit. I’ve tried deactivating every single shader or sprite that this object is using in order to discard high graphic usage, but the problem persists even if the object is a blank circle.

this is the coroutine I’m using:

IEnumerator restorePosition() {         float counter = 0;         while(counter < duration) {             counter += Time.deltaTime;              if (counter > duration) {                 counter = duration;             }              float framesPerTime = Vector3.Distance(zoomedTransform.position, storedPosition) / (duration - counter) * Time.deltaTime;             zoomedTransform.position = Vector3.MoveTowards(zoomedTransform.position, storedPosition, framesPerTime);              float framesPerTimeZoom = Vector3.Distance(zoomedTransform.localScale, storedScale) / (duration - counter) * Time.deltaTime;             zoomedTransform.localScale = Vector3.MoveTowards(zoomedTransform.localScale, storedScale, framesPerTimeZoom);              //restore solar system to original position             float solarSystemFrames = Vector3.Distance(solarSystem.position, solarSystemStartPOS) / (duration - counter) * Time.deltaTime;             solarSystem.position = Vector3.MoveTowards(solarSystem.position, solarSystemStartPOS, solarSystemFrames);             yield return null;         }          //zoomedTransform.position = storedPosition;         zoomed = false;         spriteMask.frontSortingLayerID = originalFrontLayerID;         spriteMask.backSortingLayerID = originalBackLayerID;         zoomedTransform.localScale = storedScale;          foreach(SpriteRenderer s in spriteChildren) {                 s.sortingLayerName = originalLayer;         }          foreach(OrbitController o in planets) {             o.restartAnimation();              }         inTransition = false;          //set moon layer  values back to original         if (moon != null) {             moon.gameObject.GetComponent<SpriteMask>().isCustomRangeActive = true;             moon.gameObject.GetComponent<SpriteRenderer>().sortingLayerName = moonLayerName;             foreach (Transform child in moon) {                 child.GetComponent<SpriteRenderer>().sortingLayerName = moonLayerName;             }             moon.GetComponent<MoonBehaviour>().zoomOut();             //reset null transform and layer names             moon = null;             moonLayerName = null;         }         yield break;     } 

Could you give me an idea of what I’m doing wrong? , I’ve also tried Lerp and that didn’t solve the problem. Thank you!

VLC SDR 10 Bit 4k video stuttering in Ubuntu 16.04 on ThinkPad P52 with NVidia Quadro P1000

I have Ubuntu 16.04 LTS and Windows 10 installed on my ThinkPad P52.

Hardware configuration is –
Processor: i7 8750H (6 cores, 12 threads)
RAM: 16 GB 2400 MHz
NVME Drive: Samsung NvME EVO Plus 500GB
GPU: NVidia Quadro P1000 (Mobile)

enter image description here

I believe hardware configuration is more than enough to play 4k SDR videos with 10 bit encoding.

When I play SDR 4k 10 bit video using VLC 3 on Windows 10, it works perfectly smooth. But, when I play the same SDR 4k 10 bit video using VLC (both VLC 3 and VLC 4) on Ubuntu 16.04, it continuously stutters.

NVidia Graphics Driver on Ubuntu is already installed which is available in official repository. The version is 384.

enter image description here

Anybody know what’s the issue and how can I fix it?

Stuttering Bluetooth Audio 18.04


Audio over bluetooth is unlistenable due to constant stuttering.

System details:

  • Kubuntu 18.04
  • USB bluetooth dongle (listed in lsusb as: 0b05:17cb ASUSTek Computer, Inc. Broadcom BCM20702A0 Bluetooth)
  • Computer connected to internet by Ethernet (no wifi)
  • packages up to date
  • 2 x Intel Xeon 5150 processors
  • about 8GB of RAM

Things that aren’t the problem:

  • the problem is not interference (the headphones work fine on my phone / Windows computer in the same location)
  • audio in general (audio over headphone jack is fine)
  • probably not a connection issue (the headphones connect quickly, and I’ve disabled bluetooth on my phone and Windows laptop while testing)

I’ve tried:

  • updating bluez (Bluetooth Problem Ubuntu 18.04 LTS)
  • modifying the tsched on module-udev-detect (Crackling and delayed sound after upgrading to 18.04)
  • modifying nice and suchlike (https://forums.linuxmint.com/viewtopic.php?f=42&t=44862)
  • editing the alsa config to use model=generic (A2DP on PulseAudio – terrible choppy/skipping audio)
  • enabling threadirqs and installing rtirq-init (How to get a consistent bluetooth audio playback?)

Nothing has worked. It’s probably 50% better now with threadirqs and rtirq-init, but it’s still unusable…

Any pointers for more things to try would be much appreciated.

Unusual RAM usage and stuttering

Specs: GTX 1660 TI 512GB SSD DDR4 8GB 3200Mhz RAM Ryzen 5 1600 CPU

So using Kubuntu, the RAM usage sits at 0.8GB using nothing. Using Firefox, it hits 1.4GB RAM Then once I start playing almost ANY game, my RAM shoots up much higher than on windows 10, and for games like ARK: Survival Evolved or Rocket League my RAM hits 5GB – 18GB RAM usage. I started playing a Minecraft modpack, and my RAM hit 7GB out of 8GB and my SWAP hit around 11GB itself when I set my modpack to only use 4GB RAM.

I’m not understanding why Ubuntu uses so much more RAM for things? Afterwards, I start stuttering REALLY badly once I hit my SWAP file.

Is there anyway to fix this? I’d love to play games without worrying about RAM or such, especially when I can play them with around 2GB on windows 10. Thanks! If I’m missing any needed information, tell me and I’ll add it.

Ubuntu 18.04.2 LTS – Bluetooth Speaker Sound Stuttering When Unused For While

I’m using Ubuntu 18.04.2 LTS, and I have a speaker that works via Bluetooth. I can connect it to my laptop easily, listen to whatever I want with pure sound and no problems, but I face the problem of sound stuttering if I didn’t use the speaker for a while. This occurs when:

  1. The speaker is connected via Bluetooth.
  2. I don’t play any music/videos/etc for something like 10 minutes.
  3. I want to play some music/video/etc after 10 minutes of inactivity.
  4. The sound stutters and is very bad.
  5. If I disconnect the speaker and connect it again, it works and the sound is pure again.

It’s annoying to disconnect and connect my speaker like 20 times a day, and I obviously can’t keep listening to music all the time just to prevent this from happening. How can I solve this so the sound is always pure? Note: I tested it on other devices/operating systems and it works fine so the problem isn’t from the speaker.