nicolasgramlich/AndEngine — Issue #8: Moving touch area with camera
Author: theblacknight
Created: 2012-01-14 04:11:19+00:00
State: open

I had an issue where I was moving the camera, and adding sprites to the scene. I registered those sprites as touch areas, however the touch listener was not being called. The CameraScene class is translating the CameraScene coordinates in to screen coordinates, and hence not registering the touches on the sprites that had been registered 'off screen'.

The code is in org.anddev.andengine.engine.camera.Camera, line 313:

public void convertSceneToCameraSceneTouchEvent(final TouchEvent pSceneTouchEvent) {

this.unapplySceneRotation(pSceneTouchEvent);

this.applySceneToCameraSceneOffset(pSceneTouchEvent);

this.applyCameraSceneRotation(pSceneTouchEvent);
}

I added a boolean flag to the camera class to switch this on and off, and it seems to work fine. Related form post here: http://www.andengine.org/forums/gles1/registered-toucharea-moves-with-camera-t5018.html