monkeypanic [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=20820 Jittering Camera <p>I am coming back to Pico8 after a few month pause just to find that I still cannot fix a problem I have with my platformer project. I would appreciate any help on it.</p> <p>what I have: </p> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/20820/yabai__0.gif" alt="" /> <img style="margin-bottom:16px" border=0 src="https://www.lexaloffle.com/bbs/files/20820/yabai__1.gif" alt="" /> <p>The camera follows a point offset from the character.<br /> I achieved a rubberband effect with</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>v = (cam.aim-cam.p)*0.1 cam.p += v </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>where <em>cam.aim</em> is a vector with an offset from the players position vector and <em>cam.p</em> is the current camera position.<br /> When using the parachute this is only true when the character has a certain distance form the camera position. Also there is a different behavior while the parachute is opening.</p> <p>While the camera is totaly fine while running and jumping, it becomes jittery when the character is mid air and moving really slowly. That's because, I think, the camera cannot decide if it is one pixel away from it's destination or not. </p> <p>Whatever I do .. It stays that way. or doesn't work at all ^^&quot;</p> <p>How can I force it to stay at it's destination position when moving really slow?</p> https://www.lexaloffle.com/bbs/?tid=35028 https://www.lexaloffle.com/bbs/?tid=35028 Sun, 11 Aug 2019 17:21:05 UTC