PointerLockControls.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <!DOCTYPE html>
  2. <html lang="ko">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:EventDispatcher] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. 해당 클래스의 구현은 [link:https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API Pointer Lock API] 를 기반으로 합니다. [name] 은 1 인칭 3D 게임을 위한 완벽한 선택입니다.
  14. </p>
  15. <h2>Code Example</h2>
  16. <code>
  17. const controls = new PointerLockControls( camera, document.body );
  18. // UI를 표시하거나 숨기기 위해 이벤트 리스너를 추가합니다. (예시: 게임 메뉴)
  19. controls.addEventListener( 'lock', function () {
  20. menu.style.display = 'none';
  21. } );
  22. controls.addEventListener( 'unlock', function () {
  23. menu.style.display = 'block';
  24. } );
  25. </code>
  26. <h2>예시</h2>
  27. <p>[example:misc_controls_pointerlock misc / controls / pointerlock ]</p>
  28. <h2>생성자</h2>
  29. <h3>[name]( [param:Camera camera], [param:HTMLDOMElement domElement] )</h3>
  30. <p>
  31. <p>
  32. [page:Camera camera]: 렌더링 된 장면의 카메라입니다.
  33. </p>
  34. <p>
  35. [page:HTMLDOMElement domElement]: 이벤트 리스너에 사용되는 HTML 엘리먼트입니다.
  36. </p>
  37. <p>
  38. 새로운 [name] 객체를 생성합니다.
  39. </p>
  40. </p>
  41. <h2>이벤트</h2>
  42. <h3>change</h3>
  43. <p>
  44. 사용자 마우스가 움직일 떄 호출됩니다.
  45. </p>
  46. <h3>lock</h3>
  47. <p>
  48. 포인터의 잠금 상태가 "잠김" 일 때 호출됩니다 (in other words: the mouse is captured).
  49. </p>
  50. <h3>unlock</h3>
  51. <p>
  52. 포인터의 잠금 상태가 "잠금 해제" 일 때 호출됩니다. (in other words: the mouse is not captured anymore)
  53. </p>
  54. <h2>특성</h2>
  55. <h3>[property:HTMLDOMElement domElement]</h3>
  56. <p>
  57. 마우스 / 터치 이벤트를 수신하는 데 사용되는 HTMLDOMElement입니다. 이것은 생성자에 의해 설정되어야 합니다;
  58. 생성자를 통해 설정되지 않을 경우 새 이벤트 리스너에 설정되지 않습니다.
  59. </p>
  60. <h3>[property:Boolean isLocked]</h3>
  61. <p>
  62. 컨트롤의 잠김 여부를 설정합니다.
  63. </p>
  64. <h3>[property:Float maxPolarAngle]</h3>
  65. <p>
  66. 카메라 피치(pitch)의 상한값을 설정합니다. 0 부터 Math.PI 라디안까지 범위를 가질 수 있습니다. 기본값은 Math.PI 입니다.
  67. </p>
  68. <h3>[property:Float minPolarAngle]</h3>
  69. <p>
  70. 카메라 피치(pitch)의 하한값을 설정합니다. 0 부터 Math.PI 라디안까지 범위를 가질 수 있습니다. 기본값은 0 입니다.
  71. </p>
  72. <h2>메소드</h2>
  73. <p>일반적인 메소드는 [page:EventDispatcher] 클래스를 참조하세요.</p>
  74. <h3>[method:null connect] ()</h3>
  75. <p>
  76. 컨트롤의 이벤트 리스너를 추가합니다.
  77. </p>
  78. <h3>[method:null disconnect] ()</h3>
  79. <p>
  80. 컨트롤의 이벤트 리스너를 제거합니다.
  81. </p>
  82. <h3>[method:Vector3 getDirection] ( [param:Vector3 target] )</h3>
  83. <p>
  84. <p>
  85. [page:Vector3 target]: 타겟 벡터를 의미합니다.
  86. </p>
  87. <p>
  88. 카메라가 보고있는 방향을 반환합니다.
  89. </p>
  90. </p>
  91. <h3>[method:null lock] ()</h3>
  92. <p>
  93. 포인터 잠금을 활성화합니다.
  94. </p>
  95. <h3>[method:null moveForward] ( [param:Number distance] )</h3>
  96. <p>
  97. <p>
  98. [page:Number distance]: 앞으로 이동할 거리를 설정합니다.
  99. </p>
  100. <p>
  101. 카메라를 xz-평면에 평행하게 앞으로 이동합니다. camera.up을 y-up이라고 가정합니다.
  102. </p>
  103. </p>
  104. <h3>[method:null moveRight] ( [param:Number distance] )</h3>
  105. <p>
  106. <p>
  107. [page:Number distance]: 오른쪽으로 이동할 거리를 설정합니다.
  108. </p>
  109. <p>
  110. 카메라를 xz 평면에 평행하게 옆으로 이동합니다.
  111. </p>
  112. </p>
  113. <h3>[method:null unlock] ()</h3>
  114. <p>
  115. 포인터 잠금을 종료합니다.
  116. </p>
  117. <h2>Source</h2>
  118. <p>
  119. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/PointerLockControls.js examples/jsm/controls/PointerLockControls.js]
  120. </p>
  121. </body>
  122. </html>