Skip to content

raffaelecassia/vue-gl-firstpersoncamera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-gl-firstpersoncamera

A quick and dirty first person camera for Vue-GL

demo

USAGE

Install it:

npm install --save vue-gl-firstpersoncamera

And in .vue file:

<template>
  <vgl-renderer camera="camera" scene="scene">
    <vgl-scene>
    ...
    </vgl-scene>

    <first-person-camera name="camera" scene="scene"
        v-model="pos"
        v-on:unlock="onCameraUnlock"
        v-on:move="onCameraMove">
    </first-person-camera>

  </vgl-renderer>
</template>

<script>
import FirstPersonCamera from 'vue-gl-firstpersoncamera'

export default {
  components: {
    FirstPersonCamera
  },
  data: () => ({
    pos: { x: 0, z: 100, yrot: -0.5 }
  }),
  methods: {
    onCameraUnlock(position) {
      // ...
    },
    onCameraMove(position) {
      // ...
    }
  }
}
</script>

Click on the scene to grab mouse (click again or ESC to ungrab)

WASD to move, SPACE to jump

Tested in a project created with Vue CLI

About

A quick and dirty first person camera for Vue-GL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published