- Home /
Using the accelerometer to move a player as the real user walks
Is there a way to use the accelerometer to move a player, as the user who is holding the device ('real user') walks around the room?
Hello,
i know its been a while since your question, but im facing the same issues. did you have any developments/updates on how to solve, break this problem?
(sorry for posting it on the wrong place)
Sure. Input.acceleration. http://docs.unity3d.com/ScriptReference/Input-acceleration.html
@tanoshimi thanks for your reply. i'm new at this issues so im facing problems trying to figure out how to do it. i've seen all the unity documentation but it confuses me for not knowing what and how to use it. i've tried the input.acceleration before but the results were far from what i expected. could you somehow tip/explain to me how to achieve the player movement with real user walking input?
@ado112 but dont you think it can be achievable, if not directly, through the combination of some features?
The lack of games and apps implementing this makes it clear that it unfortunately isn't possible with current devices.
Answer by ado112 · Oct 07, 2014 at 05:59 PM
I don't think that today's devices have sensors for that. This may be possible if you connect device to internet then watch it's position from satelite(google maps or something like that)but that is a very hard thing to do.
Answer by ByteSheep · Oct 09, 2014 at 12:24 PM
I have looked into this a while ago and you are not the first to ask this question. I was trying to do the same thing (like many others) for a game I was developing.
The problem is that (at least on iOS) the accelerometer can't detect linear speed movements - see here. From what I've heard it's difficult to get more than a meter or so precision with iOS devices, but would be happy to hear otherwise.
See also: http://stackoverflow.com/questions/6647314/need-to-find-distance-using-gyroaccelerometer
Thank you for the answer. I'm trying to develop it for android (at least for now), and i had already checked that link and many others but with no conclusions or answers (for me). Now i'm thinking about another approach. I'm thinking about a pedometer implementation. I know it will only count steps, but it might give me just some basic data so i can turn it into character movement. Issues with direction and position will remain, but maybe it's a start for now.
If you don't need it to be very precise (e.g. person moves 1 meter and the character moves a small distance - such as 1 meter in game) then you might be able to use the technique outlined in the stackoverflow post above.
However, I haven't personally tested this so it might be best for you to do further research and then do some tests of your own.
Let us know if you get any results ;)
Hey @Alphamox any result ? there should be results according your answer is in 2014 and now is 2017 :P