Okay, I think I know what you’re going for. Does the following illustrate the right behavior?
If you check the console log, you should see a value being logged out constantly that changes when the camera’s orientation moves. To record which direction the user was looking in, all you should have to do is collect that data over time and eventually save it in a file somewhere. If this is what you were trying to do, I think the piece you were missing was line 20, where I add the logging code to an
onBeforeRenderObservable so that it will be called repeatedly.
createScene is called only once, when the application starts up, so any code that appears in there (or, equivalently, where
createScene is called from) will only be executed once. You want to check the camera’s orientation repeatedly over time, so you need to add your code to an observable so that it’s run every time the scene renders a new frame. Hope this is helpful!