Ship Exhaust Particles

by Admiral Potato

HTML

<script src="//admiralpotato.github.io/js/npos3d/build/npos3d.min.js"></script>

JavaScript

var n = NPos3d;
var s = new n.Scene();

console.log(n);
var myShip  = new n.Ob3D();


var ExhaustParticle = function(args){
    if(this === window){throw 'Please use the `new` keyword when using the `ExhaustParticle` constructor.';}
    var args = args || {};
    var t = this;
    n.blessWith3DBase(t, args);
    t.life = 100;
    return t;
}

myShip.state = 0;
myShip.update = function(){
    var t = this;
    t.pos[0] += cos(t.state * deg) * 10;
    t.pos[1] += sin(t.state * deg) * 10;
    t.rot[2] = Math.atan2(t.pos[1],t.pos[0]);
    t.state += 10;
}

s.add(myShip);