Hopefully it's software-related and not hardware... I believe you can access the device testing menu by punching in *#0*# into the dialer. There, go to Sensor. Do an accelerometer and gyroscope test.
This is random, and maybe an easter egg... but you get a chihuahua puppy picture for the accelerometer test, lol. I also had no idea there is a barometer in here.
If those tests don't run properly, probably give Samsung a call, or take it back to the dealer.
Cheers.