GameMaker Camera_create_view update problem

G

Geo_rge

Guest
Hi! In GMS2 i'm trying to create new camera with camera_create_view() and update it's position with
camera_set_view_pos(). But for some reason this camera didn't update new position.

Here is a code in CREATE
Code:
//Set Vievport
if !view_enabled
{
   view_visible[0] = true;
   view_enabled = true;
}

//Destroy Previous default Camera
camera_destroy(view_camera[0]);

// Creating camera
view_camera[0] = camera_create_view(0,0,view_wport[0],view_hport[0],0,0,-1,-1,-1,-1);
And this code in STEP event
Code:
////Set Camera Position
x += (xto - x)*0.03;
y += (yto - y)*0.03;
xto = cam_follow.x;
yto = cam_follow.y;

camera_set_view_pos(view_camera[0] ,floor(x-view_wport[0]*0.5),floor(y-view_hport[0]*0.5));
So, if i'm using default camera without creating new one with camera_create_view, everything is working perfect. Also if I use camera_create() instead of camera_create_view, that's working too.
But when I use camera_create_view, and assign it to active viewport, it stops updating its position. And it looks like other setters (like camera_set_view_angle) isn't working too.

camera_get_active shows new camera's id.
view_camera[0] also shows new camera's id.
view_set_camera(0,new_camera_id) not helping

Can you help me please to explain what i'm doing wrong?
Sorry for bad English.
 
G

Geo_rge

Guest
OK. I solve this problem. The mistake was in camera_create_view() in "object" argument. I put "0" instead of "-1"
 
Top