FirstPersonControls.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <!DOCTYPE html>
  2. <html lang="en">
  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:Controls] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. This class is an alternative implementation of [page:FlyControls].
  14. </p>
  15. <h2>Import</h2>
  16. <p>
  17. [name] is an add-on, and must be imported explicitly.
  18. See [link:#manual/introduction/Installation Installation / Addons].
  19. </p>
  20. <code>
  21. import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js';
  22. </code>
  23. <h2>Examples</h2>
  24. <p>[example:webgl_geometry_terrain webgl / geometry / terrain ]</p>
  25. <h2>Constructor</h2>
  26. <h3>[name]( [param:Camera object], [param:HTMLDOMElement domElement] )</h3>
  27. <p>
  28. [page:Camera object]: The camera to be controlled.
  29. </p>
  30. <p>
  31. [page:HTMLDOMElement domElement]: The HTML element used for event listeners. (optional)
  32. </p>
  33. <p>
  34. Creates a new instance of [name].
  35. </p>
  36. <h2>Properties</h2>
  37. <h3>[property:Boolean activeLook]</h3>
  38. <p>
  39. Whether or not it's possible to look around. Default is `true`.
  40. </p>
  41. <h3>[property:Boolean autoForward]</h3>
  42. <p>
  43. Whether or not the camera is automatically moved forward. Default is `false`.
  44. </p>
  45. <h3>[property:Boolean constrainVertical]</h3>
  46. <p>
  47. Whether or not looking around is vertically constrained by [[page:.verticalMin], [page:.verticalMax]]. Default is `false`.
  48. </p>
  49. <h3>[property:Number heightCoef]</h3>
  50. <p>
  51. Determines how much faster the camera moves when it's y-component is near [page:.heightMax]. Default is *1*.
  52. </p>
  53. <h3>[property:Number heightMax]</h3>
  54. <p>
  55. Upper camera height limit used for movement speed adjustment. Default is *1*.
  56. </p>
  57. <h3>[property:Number heightMin]</h3>
  58. <p>
  59. Lower camera height limit used for movement speed adjustment. Default is *0*.
  60. </p>
  61. <h3>[property:Boolean heightSpeed]</h3>
  62. <p>
  63. Whether or not the camera's height influences the forward movement speed. Default is `false`.
  64. Use the properties [page:.heightCoef], [page:.heightMin] and [page:.heightMax] for configuration.
  65. </p>
  66. <h3>[property:Boolean lookVertical]</h3>
  67. <p>
  68. Whether or not it's possible to vertically look around. Default is `true`.
  69. </p>
  70. <h3>[property:Number lookSpeed]</h3>
  71. <p>
  72. The look around speed. Default is `0.005`.
  73. </p>
  74. <h3>[property:Boolean mouseDragOn]</h3>
  75. <p>
  76. Whether or not the mouse is pressed down. Read-only property.
  77. </p>
  78. <h3>[property:Number movementSpeed]</h3>
  79. <p>
  80. The movement speed. Default is *1*.
  81. </p>
  82. <h3>[property:Number verticalMax]</h3>
  83. <p>
  84. How far you can vertically look around, upper limit. Range is 0 to Math.PI radians. Default is `Math.PI`.
  85. </p>
  86. <h3>[property:Number verticalMin]</h3>
  87. <p>
  88. How far you can vertically look around, lower limit. Range is 0 to Math.PI radians. Default is *0*.
  89. </p>
  90. <h2>Methods</h2>
  91. <h3>[method:undefined handleResize] ()</h3>
  92. <p>
  93. Should be called if the application window is resized.
  94. </p>
  95. <h3>[method:FirstPersonControls lookAt]( [param:Vector3 vector] )<br />
  96. [method:FirstPersonControls lookAt]( [param:Float x], [param:Float y], [param:Float z] )</h3>
  97. <p>
  98. <p>
  99. <p>
  100. vector - A vector representing the target position.
  101. </p>
  102. <p>
  103. Optionally, the x, y, z components of the world space position.
  104. </p>
  105. </p>
  106. <p>
  107. Ensures the controls orient the camera towards the defined target position.
  108. </p>
  109. </p>
  110. <h2>Source</h2>
  111. <p>
  112. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/controls/FirstPersonControls.js examples/jsm/controls/FirstPersonControls.js]
  113. </p>
  114. </body>
  115. </html>