window.ondeviceorientation=function(event){
CtrlInfo["rxC"+id]=event.beta;
CtrlInfo["ryC"+id]=event.gamma;
CtrlInfo["rzC"+id]=event.alpha;
}
window.ondevicemotion = function(event){
if (event.acceleration){
CtrlInfo["ax"+id]=event.acceleration.x;
CtrlInfo["ay"+id]=event.acceleration.y;
CtrlInfo["az"+id]=event.acceleration.z;
}
if (event.rotationRate){
CtrlInfo["rx"+id]=event.rotationRate.beta;
CtrlInfo["ry"+id]=event.rotationRate.gamma;
CtrlInfo["rz"+id]=event.rotationRate.alpha;
}
if (event.accelerationIncludingGravity){
CtrlInfo["gx"+id]=event.accelerationIncludingGravity.x;
CtrlInfo["gy"+id]=event.accelerationIncludingGravity.y;
CtrlInfo["gz"+id]=event.accelerationIncludingGravity.z;
}
};