Rotation angle based on touch move
- by Siddharth
I want to rotate my stick based on the movement of the touch on the screen. From my calculation I did not able to find correct angle in degree. So please provide guidance, my code snippet for that are below.
if (pSceneTouchEvent.isActionMove()) {
pValueX = pSceneTouchEvent.getX();
pValueY = CAMERA_HEIGHT - pSceneTouchEvent.getY();
rotationAngle = (float) Math.atan2(pValueX, pValueY);
stick.setRotation((float) MathUtils.radToDeg(rotationAngle));
}