Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

libgdx move camera with touch

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    //difference between the current pointer location and the last pointer location on X axis
    float x = Gdx.input.getDeltaX();
    //difference between the current pointer location and the last pointer location on Y axis
    float y = Gdx.input.getDeltaY();

    camera.translate(-x,y);
    return true;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #libgdx #move #camera #touch
ADD COMMENT
Topic
Name
3+1 =