Help fix my camera dead zone script

hello, For my current project, I want to make it so that the main character has to walk a certain distance from the center of the screen before the camera starts moving, but every time the camera updates the position it makes a vibrating effect on Qiste. but as usual, like when pushing Qiste against the wall(which while walking causes Qiste to vibrate) the dash ability for some reason does not look blurry
Screen recording 2025-02-03 9.46.15 AM
(Note: the GIF d=is running at a much lower FPS, so it doesn’t look like what it does in the game, it is more fuzzy in the actual game)
What do I use to make the camera move smoothly every time it is supposed to, in the scene where I added the camera that does that, I have another camera that is locked to Qiste, and it moves smoothly, but there is not a dead zone, it moves when Qiste moves, can anyone tell me what I am doing wrong?

Link to the script in question: PlayCanvas | HTML5 Game Engine
Link to the scene with script implemented: PlayCanvas | HTML5 Game Engine

(Note: I am also planning on doing a screen lock script, the dead zone script is also gonna help shift the camera when it is needed for the camera to be locked at the edges of a room or something like that.)

Hi @Linkplayer!

I would at least run the code in the postUpdate function instead of the update function.

well, it didn’t fix it, but it removed some of the rumble effect, is there anything else that could mess with it, or should I have it so that it shifts twice?

well, now I also feel stupid, because I forgot to update the “position” variable after shifting the camera, so the “while” loop wasn’t updating properly, and now the camera shifting is smooth.

Yes, seems to work fine now. :+1:

Now is it possible to do some of the other parts of the camera dead zone I wanted to do, the Camera Screen Locking thing, where the camera’s x or y has to be at certain positions in certain locations? I don’t think it will be that it will help if I have to code all of the locations, the camera cannot be in, but is it possible to use a tilemap for that, or something? I want to make it so it cannot shift past the doors of the room, and cannot look through walls, similar to how the Metroid games work with camera restrictions.

No idea how to achieve that. If I needed something similar, I’d probably use a black overlay on the room and disable it when the room is unlocked or something like that.