Created
December 30, 2015 13:27
-
-
Save bitbrain/70582e62c18d1e009bd8 to your computer and use it in GitHub Desktop.
pan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private float calculatePanning(Vector3 position) { | |
if (camera != null) { | |
tmp.set(camera.up); | |
tmp.crs(camera.direction); | |
tmp.nor(); | |
final float lenX = camera.position.x - position.x; | |
final float lenY = camera.position.y - position.y; | |
final float lenZ = camera.position.z - position.z; | |
final float clampX = tmp.dot(new Vector3(lenX, lenY, lenZ)); | |
return MathUtils.clamp(clampX / MAX_PAN_DISTANCE, -1f, 1f); | |
} else { | |
return 0f; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment