[This uses GMS2's new camera system]
Pictured above is my problem; when zooming closely into the application (low resolution games), sprites appear to shake uncontrollably when I move with a smooth camera.
Extra: The background sprite is on an asset layer.
I really want to know how I can fix this; it's driving me insane.
EDIT: I'd like to add, drawing things correctly does work in the draw event. However, everything else starts to vibrate:
(seen by the round circle being static, but the character spazzing as well as the pixelated circle.)
EDIT#2: I got a patchwork solution, but it requires drawing in the draw-end event, and also drawing on the surface after it has been drawn. Which confuses me a lot.
And anything else needs to be drawn before the surface has been drawn or it makes that vibrate. I have no idea; I'm clearly doing everything wrong.
I really want to know how I can fix this; it's driving me insane.
this is all just rough work; i want to get somewhere where this works before fixing memory leaks and code.
Code:
/// enable views
view_enabled = true;
view_set_visible(0,true); // main view
/// create the camera
gameCam = camera_create();
camera_set_begin_script(gameCam, camera_update); // assign update script to camera
view_set_camera(0,gameCam); // assign camera to view 0
Code:
// note: this is where the circle is drawn, it's drawn onto a seperate
// surface, but that isn't the problem, since it does the same when drawing to application surface
surface_set_target(global.sPixelated);
draw_circle(10,10,10,0);
surface_reset_target();
/// pixelated
if surface_exists(global.sPixelated)
draw_surface(global.sPixelated,global.xView,global.yView);
else
global.sPixelated =
surface_create(surface_get_width(application_surface),surface_get_height(application_surface));
Code:
draw_surface_stretched(application_surface,0,0,windowWidth,windowHeight); // these two variables are the width and height of the user window
Code:
/// update camera to follow a view
// get xy
global.xView = lerp(global.xView,mouse_x,0.1)
global.yView = lerp(global.yView,mouse_y,0.1)
var projmat = matrix_build_projection_ortho(IDEAL_WIDTH*0.1, IDEAL_HEIGHT*0.1, -32000.0, 32000.0);
camera_set_proj_mat(view_camera[0], projmat);
var cameraMatrix_lookAt = matrix_build_lookat(global.xView,global.yView,-1,global.xView,global.yView,0, 0,1,0);
camera_set_view_mat(view_camera[0],cameraMatrix_lookAt);
EDIT: I'd like to add, drawing things correctly does work in the draw event. However, everything else starts to vibrate:
(seen by the round circle being static, but the character spazzing as well as the pixelated circle.)
EDIT#2: I got a patchwork solution, but it requires drawing in the draw-end event, and also drawing on the surface after it has been drawn. Which confuses me a lot.
Code:
if surface_exists(global.sPixelated)
{
draw_surface(global.sPixelated,global.xView,global.yView);
surface_set_target(global.sPixelated);
draw_circle(10,10,10,0);
surface_reset_target();
}
EDIT#3: Does anyone have any ideas as to why this is happening? Please.
I've found out that by even accessing a surface constantly is causing the problem; changing this:
to this:
Causes This to happen:
Whereas the commented code does this:
Which is the desired effect.
I have no idea why accessing/resetting the surface target would do this.
Last edited: