Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - graydsl

Pages: [1]
1
Support / CameraMovement
« on: October 15, 2010, 10:26:53 am »
Hiho,

I'm developing a top secret app for my bachelor thesis. :D But I have some problems implementing camera movement. It's working, but for very small finger movement, it's not moving at all, because of slowCamMovement. But if i do it without slowCamMovement it's moving much to fast. So my question is, if there is a general strategy to implement this, which is much better than my approach? Thanks guys!


Code: [Select]
private void moveCamera(float pX, float pY) {
if (!mCameraMoving) {
mLastX = pX;
mLastY = pY;
mCameraMoving = true;
return;
} else {
if (mLastX == pX && mLastY == pY) {
return;
} else if (mLastY > pY) {
// downwards
Camera cam = mWorld.getCamera();
float speed = (mLastY - pY) / slowCamMovement; // slowCamMovement = 100f;
cam.moveCamera(Camera.CAMERA_MOVEDOWN, speed);
} else {
// upwards
Camera cam = mWorld.getCamera();
float speed = (mLastY - pY) / slowCamMovement;
cam.moveCamera(Camera.CAMERA_MOVEUP, -speed);
}
lastX = pX;
lastY = pY;
}
}

Pages: [1]