So, I recently decided to start learning Unity and wanted to make a few small projects to try and understand the basics and follow some tutorials, when I came across an error. If I enable interpolation for the Player, anytime he jumps, the movement is really jerky, like the character shakes a lot, but I don’t have that problem when it’s disabled, or if I do, it’s way less noticeable. But if the interpolation is disabled and the player falls from a greater height, the movement is jerky again when he’s falling., but it isn’t if I enable interpolation. I’m guessing a solution would be to change interpolation modes on the fly when jumping, but I don’t know how to do that in C#.
The tutorial I’ve been following is Full Time Game Dev by Thomas Brush, I’m using the latest LTS version of unity at the time of writing (2021.3.9f1), with Standard Android Build Support, UWP, WebGL, on a Windows 10 system, installed through unity hub 3.2, editing the code with Visual Studio 2022 version 17.3.3. The script for the physics object is the one on unity’s website: Recorded Video Session: 2D Platformer Character Controller - Unity Learn, (the one from the first module), and I’m making the player jump by changing the velocity if the jump button is pressed and the grounded condition from the other script, which I’m referencing in this one, is true.
First, the Unity version does matter to an extent, but the build targets of WebGL, Android, etc wont matter when testing. They may have their own issues in a build on that platform, but you dont need to provide this information (most of the time). The VS version doesnt matter, Unity Hub version doesnt matter.
Second, please don’t post the actual .cs file. There is an “Insert Code” button on the text ribbon and you can copy/paste your code in there. That is how you should share code. Not files, and definitely not images.
You are a newbie so i just wanted to get that out of the way for your future posts, no worries
you are moving the rigidbody not by setting the velocity or any forces, but by “rb2d.position = rb2d.position + move.normalized * distance;” in your last code-line. That’s definitely a bug.
You can have a look at a super simple 2D character controller I wrote some time ago for a guy needing help with his 2D character controller: character_controller_2d.unitypackage - Google Drive
Nothing special, not much code, does the job, is physics based and could help you learn how to get started with a simple character controller :).