1.0.2 • Published 5 years ago

vue-gl-firstpersoncamera v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago