Giter Site home page Giter Site logo

godotmobilestepscounter's Introduction

GodotMobileStepsCounter

This class record the movement of the phone via accelerometer for steps counting.

It records the user acceleration every tick and calculate if a step was made based on this information.

Notes: 1). shakes of the phone will count as steps. But this is a limitation of the accelerometer, and the fact that this algorithm is really general.

2). works best when the phone is placed firmly on the body

3). this won't use the gyroscope, only the accelerometer. its better because some devices don't have gyroscope, but do have accelerometer. Using the gyroscope might make the algorithm easier and more effecient though.

4). this script won't be useful on non-mobile devices and won't show results in the editor (EVEN ON YOUR PHONE!) the only way to test this is with a game build. so build frequently to test that everything works fine (this is a Godot limitation, the Input.get_accelerometer() returns a non 0 value only while building)

5). Never tested this on iOs.

How to use in project: 0). Create a scene instancing Node, and attach this script to it (I'd call it movement_sensor, but you can call it whatever you want).

1). Instance the scene (from step 0) in your tree somewhere

2).read get_steps_counter() every time you need to know how much steps have gone since the monitoring started or use the signal "steps_updated" note that the class is updated every tick anyways. if you want to stop monitoring the steps, use the function stop_monitoring()

3). adjust the the step_threshold value for your needs. This is what controls the sensitivity. Higher values are are less sensitive. e.g. values below 0.25, will most likely count every small movement as a step made while values higher than 1 won't count any steps on my device.

godotmobilestepscounter's People

Contributors

godrabbit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.