[]陀螺仪接口无效呢?Gyroscope.instance.on(Event.CHANGE, this, onOrientationChange); 什么原因呢

已邀请:

game4d

赞同来自:

var firstTime = true;
laya.device.motion.Gyroscope.instance.on(Event.CHANGE, this, onOrientationChange);
function onOrientationChange(absolute, info)
{
if (info.alpha === null)
{
addLog("当前设备不支持陀螺仪。");
return;
}
else if (firstTime && !absolute && !Browser.onIOS)
{
firstTime = false;
addLog("在当前设备中无法获取地球坐标系,使用设备坐标系,你可以继续观赏,但是提供的方位并非正确方位。");
}
addLog("Gyroscope " + Math.floor(info.alpha));

}
 

Monica - 知识达人

赞同来自:

你的意思是没有走onOrientationChange函数吗?如果是的话你在Event前边加个Laya.看下

189*****132

赞同来自:

遇到相同的问题了,大佬,解决了吗?

要回复问题请先

商务合作
商务合作