Learning three.js 09 :: Shooting & Projectiles

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



Duration: 6:32
23,724 views
248


Adding a system for shooting projectile bullets. Source linked below.

In this video I create a very simple method for managing bullets in game, and solve problems such as bullet positioning, weird velocity vectors, and memory cleanup. An array is made to store bullets as THREE.Mesh, with an "alive" flag to track when bullets should be cleaned up.

This program uses code from video eight.

Because the bullets are THREE.Meshes, we can set them to be any mesh we want - see the bonus footage at the end to fully experience the gravity of this consequence.

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

Models sourced from http://kenney.nl.
threejs website - http://threejs.org

Direct your fruit/gift baskets to cahill.julian@gmail.com.

http://rawr.nz







Tags:
threejs
three.js
shooting
projectiles
bullets
physics
vector
webgl
firefox
chrome
opengl
opengl es
3D
browser
games
demo
source code
lighting
shadows
models
OBJ
MTL
github
THREE.Mesh
insecure.gq