threepipe
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ThreeFirstPersonControlsPlugin.md 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. ---
  2. prev:
  3. text: 'PointerLockControlsPlugin'
  4. link: './PointerLockControlsPlugin'
  5. next:
  6. text: 'GLTFKHRMaterialVariantsPlugin'
  7. link: './GLTFKHRMaterialVariantsPlugin'
  8. ---
  9. # ThreeFirstPersonControlsPlugin
  10. [//]: # (todo: image)
  11. [Example](https://threepipe.org/examples/#three-first-person-controls-plugin/) —
  12. [Source Code](https://github.com/repalash/threepipe/blob/master/src/plugins/interaction/ThreeFirstPersonControlsPlugin.ts) —
  13. [API Reference](https://threepipe.org/docs/classes/ThreeFirstPersonControlsPlugin.html)
  14. ThreeFirstPersonControlsPlugin adds support for using FirstPersonControls from three.js. It works similar to idle look around in first person games, it does not captures the mouse pointer.
  15. After the plugin is added, it adds support for setting `threeFirstPerson` as the key in `scene.mainCamera.controlMode`.
  16. Sample Usage
  17. ```typescript
  18. import {ThreeViewer, ThreeFirstPersonControlsPlugin, Mesh2} from 'threepipe'
  19. const viewer = new ThreeViewer({...})
  20. viewer.addPluginSync(ThreeFirstPersonControlsPlugin)
  21. // after some user action
  22. viewer.scene.mainCamera.controlsMode = 'threeFirstPerson'
  23. // switch back to default orbit controls
  24. viewer.scene.mainCamera.controlsMode = 'orbit'
  25. ```