Skip to content

Instantly share code, notes, and snippets.

@acanthite1855
acanthite1855 / CameraController.kt
Last active November 12, 2020 19:11
A simple CameraController for LibGDX from one of my old projects. Allows smooth zooming, translation, rotation and setting padding for OrthographicCamera. All the same!
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.math.Interpolation
import com.badlogic.gdx.math.MathUtils
import com.badlogic.gdx.math.Vector2
import com.badlogic.gdx.math.Vector3
import kotlin.math.min
class CameraController(
var camera: OrthographicCamera,
worldWidth: Int,