android - 用传感器移动全景图

时间:2014-02-21 10:31:40

标签: android android-sensors panoramas

我有一个大问题。 我有一个立方体全景图,我会用传感器移动那个全景图。

我控制了加速度计,但我不知道如何移动全景图。

private SensorManager mSensorManager;
private Sensor mAccelerometer;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
...
...

PLCubicPanorama cubicPanorama = new PLCubicPanorama();
cubicPanorama.setImage(new PLImage(PLUtils.getBitmap(getApplicationContext(), R.raw.apollo01_cubefront), false), PLCubeFaceOrientation.PLCubeFaceOrientationFront);
cubicPanorama.setImage(new PLImage(PLUtils.getBitmap(getApplicationContext(), R.raw.apollo01_cubeback), false), PLCubeFaceOrientation.PLCubeFaceOrientationBack);
cubicPanorama.setImage(new PLImage(PLUtils.getBitmap(getApplicationContext(), R.raw.apollo01_cubeleft), false), PLCubeFaceOrientation.PLCubeFaceOrientationLeft);
cubicPanorama.setImage(new PLImage(PLUtils.getBitmap(getApplicationContext(), R.raw.apollo01_cuberight), false), PLCubeFaceOrientation.PLCubeFaceOrientationRight);
cubicPanorama.setImage(new PLImage(PLUtils.getBitmap(getApplicationContext(), R.raw.apollo01_cubetop), false), PLCubeFaceOrientation.PLCubeFaceOrientationUp);
cubicPanorama.setImage(new PLImage(PLUtils.getBitmap(getApplicationContext(), R.raw.apollo01_cubebottom), false), PLCubeFaceOrientation.PLCubeFaceOrientationDown);

this.load(new PLJSONLoader("res://raw/json_cubic"), true, new PLTransitionBlend(2.0f));
this.setPanorama(cubicPanorama);
}

public void onSensorChanged(SensorEvent event) {
    if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
      Log.i("SENSORE", "TYPE_ACCELEROMETER");
              //HOW TO MOVE THE PANORAMA??
            }
}

任何人都可以帮助我吗?

0 个答案:

没有答案