britzl
britzl/defold-gyro/gyro
Gyroscope rotation for Defold on iOS and Android, delivered as a quaternion every frame.
- GitHub: britzl/defold-gyro — pinned to
1.1.1- Pick a release from britzl/defold-gyro releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as gyro from "gyro"
- Pick a release from britzl/defold-gyro releases and add its Source code (zip) URL (or a packaged
Functions
start(listener: (self: unknown, quatx: number, quaty: number, quatz: number, quatw: number) => void)
Starts the gyroscope. While started, the listener is invoked every frame with the device rotation as a quaternion.
Parameters
listener:(self: unknown, quatx: number, quaty: number, quatz: number, quatw: number) => void— Called every frame as(self, quatx, quaty, quatz, quatw).
stop()
Stops the gyroscope.