Skip to content

Instantly share code, notes, and snippets.

@ikeryou
Last active July 23, 2018 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikeryou/49b318feb8571bcb04e85097577e0dd0 to your computer and use it in GitHub Desktop.
Save ikeryou/49b318feb8571bcb04e85097577e0dd0 to your computer and use it in GitHub Desktop.
3Dでのピクセル等倍
// カメラ座標
var cameraPos = new Vector3();
// ステージ高さ
var stageHeight = 900;
// 度単位でのカメラの視野
var fieldOfView = 45;
// ピクセル等倍になるカメラZ値
var z = stageHeight / Math.tan(fieldOfView * Math.PI / 360) / 2;
// -つけるかどうかはライブラリによるので注意
cameraPos.z = -z;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment