threepipe
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

ThreeFirstPersonControlsPlugin.md 1.2KB

1 ano atrás
1 ano atrás
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 capture 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. ```