0

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

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

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??
            }
}

有谁能够帮我??

4

0 回答 0