Added code to update cube when the state changes (for gyro mode)