June 2013
Intermediate to advanced
346 pages
8h 42m
English
Currently we can only see a very small part of the skybox on our screen. Wouldn’t it be nice if we could pan around and see the rest of the skybox? We can easily do that by listening for touch events and using those touch events to rotate the skybox and scene together.
Open up ParticlesActivity, and add the following code before the call to setContentView:
| Skybox/src/com/particles/android/ParticlesActivity.java | |
| | glSurfaceView.setOnTouchListener(new OnTouchListener() { |
| | float previousX, previousY; |
| | |
| | @Override |
| | public boolean onTouch(View v, MotionEvent event) { |
| | if (event != null) { |
| | if (event.getAction() == MotionEvent.ACTION_DOWN) { |
| | previousX = event.getX(); |
| | previousY = event.getY(); ... |
Read now
Unlock full access