Accelerometer with creator

Accelerometer with creator
0.0 0


Does this work with creator?

I have an example from cocos js but I cannot seem to get it to work on android in creator.


OK I Finally got this working. For Anyone else interested here is the code

onLoad: function () {

    cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);


onDeviceMotionEvent (event) {

    var x = event.acc.x;
    var y = event.acc.y;

// use as you wish



My Typescript is screaming like hell

But it works! Thanks mate!

Edit: this works fantastic for mobile. You really saved my day. Thanks for sharing!