Learning three.js 08 :: First Person Gun View

Channel:
Subscribers:
1,090
Published on ● Video Link: https://www.youtube.com/watch?v=9wSWaKRtVy4



Duration: 6:36
24,207 views
178


Implementing a first person gun view in three.js. Source code in the description.

This program uses code produced in video seven.

We add a new model from kenney.nl into our code, and position it in front of our camera. We also add a simple idle 'animation' so that the gun isn't permanently stuck in place. Also added in this video were optional arguments in the models index, castShadow and receiveShadow. By default, these are both active. However, you can now set model specific options to toggle either of these settings.

The weapon in this video is positioned according to some constants. Technically, the set of constants should be moved to a "viewmodel" object, so that they're easy to change. I will do this before the next video whose code is based on this one.

My university break has started now, so I should be able to post quite a few videos in the coming weeks.
If you want to see what's coming next, take a look at the github repo (linked below). The live demo for the next video is often available a day or two earlier than the video release.

source code - https://github.com/saucecode/threejs-demos/tree/master/08_GunView
live demo - https://rawr.nz/webgl2/08_GunView/index.html
github repo - https://github.com/saucecode/threejs-demos

threejs - https://threejs.org
kenney.nl - quality & free game assests - http://kenney.nl/assets?q=3d

Send your cocktail recipies, movie recommendations, and queries to cahill.julian@gmail.com

http://rawr.nz/







Tags:
threejs
three.js
webgl
opengl
opengl es
first person camera
fps
gun
weapon
source code
live demo
github
kennel
uzi
guns
shadow
light
learning
viewmodel
gun view