camera_set_view_target


Description

You can use this function to set the follow target of the view camera within the room. You give the unique camera ID value (as returned by the different camera_create functions) and then give the target instance or object ID that you wish to set the camera view to. Note that if you choose an object ID and there is more than one instance of that object in the room, there is no way for GameMaker Studio 2 to know which instance you wish to follow and so it could be any of them.


Syntax:

camera_set_view_target(camera_id, instance_id/object_id)


Arguments:

Argument Description
camera_id The unique camera ID value returned when you created the camera
instance_id/object_id Instance or object to have the camera target for following


Returns:

N/A


Example:

camera_set_view_target(view_camera[0], id);

The above code will set the view camera target for the camera assigned to view port[0] to that of the instance running the code.


Back: Cameras
Next: camera_set_default
© Copyright YoYo Games Ltd. 2018 All Rights Reserved