Im new to unity and programming and I am trying to create a simple platforming game right now. But I ran into a problem with the pixelperfect camera following the player where it stutters a little bit back and forth. Ask if you need additional information(the camera collider transform is allways in the same position as the player
#Problem with camera stuttering while flollowing player
1 messages · Page 1 of 1 (latest)
!code
Posting code
📃 Large Code Blocks
Use links to services like:
https://paste.mod.gg/, https://hastebin.skyra.pw/, https://paste.ofcode.org/, https://paste.myst.rs/
📃 Inline Code
Surround code with three backquotes. Not quotation marks.
To format as C#, add cs to the first line:
```cs
// Your code here
```
Add a comment with a line number if there is an error message.
put your camera code in LateUpdate so it can react to changes in the player's position in the current frame
The camera follow script is likely causing it. The player moves so slowly that with a delayed camera follow it's going to bounce between 1 and 0 pixels behind the player
when changing the camera script to just: transform.position = player.transform.position; It looks like this
How is your player object moving
@lyric steeple I tried, but it didt change anything
If you're using a Rigidbody make sure it has interpolation enabled and that your code doesn't modify the transform directly at any point
thank you I will test that
What's the issue with this?
nothing but thats not what I want
when I set the player to interpolate(and with my original camera script) I get this:
the grass looks better but the player stutter is still there
What do you not want?
the camera movement from the first clip in the chat
Ok but what do you not want from the second clip?
I just wanted to show what it looks like when I disable the custom camera movement that I built
wait I just saw that the last clip is the same as the one before
my problem is that the player glitches between 2 pixels back and forth
can you show your entire player movement script?
sorry didnt have time, if you still want to help me:
my code is probably messy because I only recently started coding