Hi guys, i have to post a new thread cause i just cant fix this problem.
So the thing is, i am bulding a 2D platformer game, like Geometry dash, where you can only control the Jump. So i have created a script for moving the player non stop on the X and adding a velocity to rigidbody2d on the Y when the player taps the screen. Its all working fine but here is the problem.
When i use a camera that follows him just on the X axis, its fine, everything works as it should. Now when i use the same camera to follow him on the Y it works too, but it moves with him everytime i jump, and that is just weird, it makes you dizzy from looking at it.
Now i have used a bunch of different scripts, one with Smoothing and one with deadzones and the last one is great, when you hit a certain height it justs moves the camera to follow you on Y and when you go down it reverts to normal, so the camera doesnt jump everytime you jump so to speak.
Now the issue is when i use any camera that has Smoothing or Deadzones or any camera that doesnt follow the exact movement of the player, i get lags on my movement. Its like he is teleporting back and forth a little, it looks real bad, and i tried everything.
Using FixedUpdate, LateUpdate, Smooth time for Delta time etc
I even tried animating the camera movement, i even buyed the Camera Path hoping it would fix it, but no, its still the same. Any Damping or Smoothing or anything when the camera is not the same speed as the player he starts lagging.
Well thats the best explanation i can give you without a video.
So can it be that my movement script is wrong? This is the part of the script for moving the player on the X.
Vector3 temp = transform.position;
temp.x += forwardSpeed * Time.smoothDeltaTime;
transform.position = temp;
I just cant find a fix for this lagging. So can you guys tell me, if there is a better way to move the player, and a way to stop the lagging.
Keep in mind that i am new to programming and Unity. Just over a month and a half has passed since i started and this is a real problem and a first one i can not fix.
Thanks guys in advance! ![]()
EDIT: Fixed it. Using AddForce to move player, calling it in FixedUpdate, turning on Interpolate and using a standard assets camera did the trick. Jittering is not the issue anymore, everything is working as it should! ![]()