Getting accelerometer input (DEF-1396) (SOLVED)

As I understood problem is about other (“click”, “tap” and so on) actions have the action.acc_x, action.acc_y, action.acc_z parameters and has no action_id.
As I know defold has only one situation when action_id is nil - it is when data received from the accelerometer.

But yes, original code will be fail when some of parameters will be nill.
As option you can replace all concatenate sybbols .. (double dot) wit , (comma) (it works only with print function)

print("info#action", "action: ", action_id)
print("info#info", "info: ", tostring(action.acc_x) , ", ", tostring(action.acc_y) , ", ", tostring(action.acc_z))

UPD:
It is strange that action_id is nil, maybe have sense to make it something like accelerometer
And one more strange that developer can’t turn off accelerometer, really old task DEF-1396

3 Likes