====== Fixing the Camera to an Object manually using a Clock ====== If you wish the camera to be fixed on a moving object, you will need to use code to update it regularly. The camera's x and y coordinates are copied from the object, but not the z coordinate. ===== Code ===== void orxFASTCALL Update(const orxCLOCK_INFO *_pstClockInfo, void *_pContext) { orxVECTOR cameraPosition = { 0,0,0 }; orxCamera_GetPosition(camera, &cameraPosition); orxVECTOR heroPosition= { 0,0,0 }; orxObject_GetPosition(hero, &heroPosition); cameraPosition.fX = heroPosition.fX; cameraPosition.fY = heroPosition.fY; orxCamera_SetPosition(camera, &cameraPosition); ... } orxSTATUS orxFASTCALL Init() { ... orxClock_Register(orxClock_Get(orxCLOCK_KZ_CORE), Update, orxNULL, orxMODULE_ID_MAIN, orxCLOCK_PRIORITY_LOWER); ... Please note the use of ''orxCLOCK_PRIORITY_LOWER'' instead of ''orxCLOCK_PRIORITY_NORMAL''. This mode ensures the camera is updated **//after//** all the objects which will ensure a rock solid lock. A more simple method is to [[en:tutorials:cameras:fixing_camera_to_object_by_parenting|parent a camera to an object]].