After a bit of mucking around I think I’ve figured out most of what I need to make this work.
I’ve created a custom camera input that inherits from the FreeCameraDeviceOrientationInput and takes the rotation quaternion from the devices orientation and the rotation quaternion of the car and multiplies them together to get the direction the camera should be pointing. Problem is its only half working and the camera is turning in the wrong direction.
My math isn’t that great and quaternions both figuratively and literally make my head spin (pun intended). If anyone here has a better idea of how to make this work, (maybe @trevordev), I’d really appreciate it.
I borrowed this awesome demo and put together a quick Babylon.js Playground with my camera setup