Is there any example where camera is changing its position based on accelerometer data?
Actually the DeviceOrientationCamera is exactly that:
Babylon.js/deviceOrientationCamera.ts at master · BabylonJS/Babylon.js (github.com)
DeviceOrientationCamera just can rotate, i can’t move when i walk like six-axis vr device
This might work with XR ? @RaananW ?
reviving a 2 years old topic
WebXR is the way to go. otherwise - it is not recommended to use accelerometer to detect movement. You can find the direction (usually), but not the new position.
This is far as I got myself in like 1 year with a friend… opencv, accelerometer, magnetometer and GPS
…yeah, then WebXR came out
here im moving the mesh, not the camera - but should be same/same (with external accelerometer). as raanan says, can’t detect new position in space.
Could you give me more information about how you did this? I need to display real-time movement of an object in a web page based on accelerometer/gyroscope data. It’s for an academic project. I don’t really know anything about 3D modeling and manipulation and I was just checking if babylonjs could help me achieve that. What you show in your video is exactly what I need to do, so I would really appreciate if you could share the code and details with me.
the basic concept was:
- pull data from accelerometer (i used johnny-five library to do it - dunno if that’s still viable)
- I wired up the accelerometer at first and then went wireless via bluetooth (which was much more complicated)
- then sent the xyz data into babylon via a socket connection
- then mirrored those xyz positions on a loaded GLB
hope that helps.
Thank you very much!