Hi, i’ve searched on the forums and google searched as well but as far as i can get, the results were about the speed of game objects in unity3d, physics, velocity of rigid bodies etc. So i’ve decided to open an question here and that question will be, is there any way of getting the speed values of mobile devices in 3d space? Like i am holding the device in my hand and moving it around in the air that type of things.I’ve tried acc which won’t work in my opinion but read it’s values as well as i used gyro and accessed my device’s gyro and read the values of it but cannot figure it out how to represent of the speed on the mobile device like say, meters per second? Could anyone point me out where to start and give me a hand about this?
Thank you!
1 Answer
1For short range movement, you would you the accelerator, it measures the acceleration on all three axis. You would have to start with an initial velocity and track the acceleration. An easy why to do this is to create a rigidbody and calculate forces from the acceleration values and apply them to the rigid body. Then the velocity of the rigidbody would approximate the velocity of the device. For the best results, you would want an accurate value for the rigidbody mass depending on the device.
For long range movement, you would use GPS an do the opposite, estimate velocity based on change in position.
That sounds good actually, i'll try it in the short range now and try to see what is going on. Thanks
– ozturkcompanyLet me know how it goes or if you hit a road block.
– Spinnernicholashey i've tried it and wrote a code that will move the cube using acc and stop it when there is no acc has been read trough the device and the idea you suggested seems like a way to go but either i couldn't do it which i did, it doesn't quite work sadly.I would look into gps but i need an easier way to do it.
– ozturkcompanyI forgot to mention that you have to deal with the constant acceleration from gravity. 1. Get Accelerometer Data. 2. Convert to Force. 3. Filter out Force of Gravity. 4. Smooth and Interpolate. 5. Apply Forces. You might want to use the Gyroscope to determine which direction is down so you can filter out gravity. And also make sure you use [Input.accelerationEvents][1] because there may be many accelerations per frame. [1]: http://docs.unity3d.com/Documentation/ScriptReference/Input-accelerationEvents.html
– SpinnernicholasYou are probably going to have to make some tools to help you understand the data. Create a GUI that shows acceleration data. Then record the values for it sitting in different orientations.
– Spinnernicholas