Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/videokit-ai/natstep
Cross-platform step counting for Unity Engine.
https://github.com/videokit-ai/natstep
android ios pedometer unity
Last synced: 28 days ago
JSON representation
Cross-platform step counting for Unity Engine.
- Host: GitHub
- URL: https://github.com/videokit-ai/natstep
- Owner: videokit-ai
- License: mit
- Archived: true
- Created: 2017-06-14T20:38:36.000Z (over 7 years ago)
- Default Branch: 1.1
- Last Pushed: 2021-01-14T21:29:54.000Z (almost 4 years ago)
- Last Synced: 2024-10-01T10:31:35.242Z (about 1 month ago)
- Topics: android, ios, pedometer, unity
- Language: C#
- Homepage:
- Size: 440 KB
- Stars: 107
- Watchers: 11
- Forks: 25
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pedometer API
Pedometer is a native pedometer API for the Unity game engine. The API provides sensor information about step count and distance covered (in meters). It is a minimalist API with native backends on iOS and Android.## Using the API
To use the API, simply create a `Pedometer` instance:
```csharp
// Create a pedometer
// The OnStep callback will be invoked each time a step is detected
var pedometer = new Pedometer(OnStep);void OnStep (int steps, double distance) {
// Display the values
stepText.text = steps.ToString();
// Display distance in feet
distanceText.text = (distance * 3.28084).ToString("F2") + " ft";
}
```When you are done detecting steps from a `Pedometer` instance, you must dispose it:
```csharp
// Dispose of this pedometer instance
pedometer.Dispose();
```## Notes
- On iOS, you must add an `NSMotionUsageDescription` key to the `Info.plist` in Xcode before building. This determines the message used to request pedometer permissions from the user.## Credits
- [Yusuf Olokoba](mailto:[email protected])