引擎加速感应器疑似Bug汇报,cocos技术组请关注

三星PM-601,首先开启自动旋屏,转到逆向横幕,然后关闭自动旋屏,锁定为逆向横幕状态。

这时启动cocos的Acceleration,运行,再监测Acceleration的xyz输出,会发现X轴和Y轴互换了。

已单独编制android感应数据输出程序对照,android系统Acceleration的输出值并未出现XY互掉的情况,基本确定仅仅是cocos的输出存在XY互换。

手头另一台三星测试手机,无此现象。

下为测试图片,手机位置基本未变,1为android系统的输出,2为cocos调用Acceleration的输出。

可以把你的android感应数据输出程序(或者项目)发给我吗?

package com.trigger.XYZtest;






import com.android.eyeeyes.R;


import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import android.hardware.SensorManager;
import android.hardware.SensorListener;


@SuppressWarnings("deprecation")
public class eyeeyes extends Activity implements SensorListener {
 
 final String tag = "IBMEyes";
 SensorManager sm = null;
 
 TextView xViewA = null;
 TextView yViewA = null;
 TextView zViewA = null;
 TextView xViewO = null;
 TextView yViewO = null;
 TextView zViewO = null;
 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        sm = (SensorManager) getSystemService(SENSOR_SERVICE);
        setContentView(R.layout.main);
        xViewA = (TextView) findViewById(R.id.xbox);
        yViewA = (TextView) findViewById(R.id.ybox);
        zViewA = (TextView) findViewById(R.id.zbox);
        xViewO = (TextView) findViewById(R.id.xboxo);
        yViewO = (TextView) findViewById(R.id.yboxo);
        zViewO = (TextView) findViewById(R.id.zboxo);
 
    }
 
 
 
    public void onSensorChanged(int sensor, float] values) {
        synchronized (this) {
            Log.d(tag, "onSensorChanged: " + sensor + ", x: " + values + ", y: " + values + ", z: " + values);
            if (sensor == SensorManager.SENSOR_ORIENTATION) {
             xViewO.setText("Orientation X: " + values);
             yViewO.setText("Orientation Y: " + values);
             zViewO.setText("Orientation Z: " + values);
            }
            if (sensor == SensorManager.SENSOR_ACCELEROMETER) {
             xViewA.setText("Accel X: " + values);
             yViewA.setText("Accel Y: " + values);
             zViewA.setText("Accel Z: " + values);
            }            
        }
    }
 
    public void onAccuracyChanged(int sensor, int accuracy) {
     Log.d(tag,"onAccuracyChanged: " + sensor + ", accuracy: " + accuracy);
 
    }
 


    @Override
    protected void onResume() {
        super.onResume();
        sm.registerListener(this, 
                SensorManager.SENSOR_ORIENTATION |
         SensorManager.SENSOR_ACCELEROMETER,
                SensorManager.SENSOR_DELAY_NORMAL);
    }
 
    @Override
    protected void onStop() {
        sm.unregisterListener(this);
        super.onStop();
    }    
 
 
}

```



检测代码如上

漏了个main.xml,补上

<?xml version="1.0" encoding="utf-8"?>





    





    



```