From 0283aed7b54e24f9a86e43741e4479df9dacc7ce Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Thu, 11 Oct 2018 22:50:32 +0200 Subject: [PATCH] Examples: Added bullet impact sounds --- build/yuka.js | 13 +++++++++ build/yuka.min.js | 34 +++++++++++----------- build/yuka.module.js | 13 +++++++++ examples/entity/shooter/audio/impact1.ogg | Bin 0 -> 10973 bytes examples/entity/shooter/audio/impact2.ogg | Bin 0 -> 8187 bytes examples/entity/shooter/audio/impact3.ogg | Bin 0 -> 8212 bytes examples/entity/shooter/index.html | 11 +++++++ examples/entity/shooter/src/Bullet.js | 9 ++++-- examples/entity/shooter/src/World.js | 3 +- src/math/MathUtils.js | 13 +++++++++ test/unit_test/math/MathUtils.tests.js | 20 ++++++++++++- 11 files changed, 95 insertions(+), 21 deletions(-) create mode 100644 examples/entity/shooter/audio/impact1.ogg create mode 100644 examples/entity/shooter/audio/impact2.ogg create mode 100644 examples/entity/shooter/audio/impact3.ogg diff --git a/build/yuka.js b/build/yuka.js index c8c57cd2..2d654053 100644 --- a/build/yuka.js +++ b/build/yuka.js @@ -25,6 +25,19 @@ } + /** + * Computes a random integer value within a given min/max range. + * + * @param {min} value - The min value. + * @param {max} value - The max value. + * @return {Number} The random integer value. + */ + static randInt( min, max ) { + + return min + Math.floor( Math.random() * ( max - min + 1 ) ); + + } + /** * Computes a random float value within a given min/max range. * diff --git a/build/yuka.min.js b/build/yuka.min.js index 4a8cfae5..c78cc143 100644 --- a/build/yuka.min.js +++ b/build/yuka.min.js @@ -28,23 +28,23 @@ void 0;try{e=d.then}catch(H){this.reject_(H);return}"function"==typeof e?this.se e}var g,k,m=new l(function(d,e){g=d;k=e});this.callWhenSettled_(f(d,g),f(e,k));return m};l.prototype.catch=function(d){return this.then(void 0,d)};l.prototype.callWhenSettled_=function(d,e){function f(){switch(g.state_){case 1:d(g.result_);break;case 2:e(g.result_);break;default:throw Error("Unexpected state: "+g.state_);}}var g=this;null==this.onSettledCallbacks_?I.asyncExecute(f):this.onSettledCallbacks_.push(f)};l.resolve=m;l.reject=function(d){return new l(function(e,f){f(d)})};l.race=function(d){return new l(function(e, f){for(var g=$jscomp.makeIterator(d),k=g.next();!k.done;k=g.next())m(k.value).callWhenSettled_(e,f)})};l.all=function(d){var e=$jscomp.makeIterator(d),f=e.next();return f.done?m([]):new l(function(d,g){function k(e){return function(f){l[e]=f;w--;0==w&&d(l)}}var l=[],w=0;do l.push(void 0),w++,m(f.value).callWhenSettled_(k(l.length-1),g),f=e.next();while(!f.done)})};return l},"es6","es3"); (function(d,k){"object"===typeof exports&&"undefined"!==typeof module?k(exports):"function"===typeof define&&define.amd?define(["exports"],k):k(d.YUKA={})})(this,function(d){function k(a,b){return ab?1:0}function m(a,b){return a.costb.cost?1:0}function g(a,b){return a.costb.cost?1:0}function l(a,b){return a.costb.cost?-1:0}function I(a,b){return"string"!==typeof a||""===a?"":/^(https?:)?\/\//i.test(a)||/^data:.*,.*$/i.test(a)||/^blob:.*$/i.test(a)? -a:b+a}var f=function(){};f.clamp=function(a,b,c){return Math.max(b,Math.min(c,a))};f.randFloat=function(a,b){return a+Math.random()*(b-a)};f.area=function(a,b,c){return(c.x-a.x)*(b.z-a.z)-(b.x-a.x)*(c.z-a.z)};var e=function(a,b,c){this.x=void 0===a?0:a;this.y=void 0===b?0:b;this.z=void 0===c?0:c};e.prototype.set=function(a,b,c){this.x=a;this.y=b;this.z=c;return this};e.prototype.copy=function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this};e.prototype.clone=function(){return(new this.constructor).copy(this)}; -e.prototype.add=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this};e.prototype.addScalar=function(a){this.x+=a;this.y+=a;this.z+=a;return this};e.prototype.addVectors=function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this};e.prototype.sub=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this};e.prototype.subScalar=function(a){this.x-=a;this.y-=a;this.z-=a;return this};e.prototype.subVectors=function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this};e.prototype.multiply= -function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this};e.prototype.multiplyScalar=function(a){this.x*=a;this.y*=a;this.z*=a;return this};e.prototype.multiplyVectors=function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this};e.prototype.divide=function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this};e.prototype.divideScalar=function(a){this.x/=a;this.y/=a;this.z/=a;return this};e.prototype.divideVectors=function(a,b){this.x=a.x/b.x;this.y=a.y/b.y;this.z=a.z/b.z;return this}; -e.prototype.clamp=function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this};e.prototype.min=function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this};e.prototype.max=function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this};e.prototype.dot=function(a){return this.x*a.x+this.y*a.y+this.z*a.z};e.prototype.cross= -function(a){var b=this.x,c=this.y,h=this.z;this.x=c*a.z-h*a.y;this.y=h*a.x-b*a.z;this.z=b*a.y-c*a.x;return this};e.prototype.crossVectors=function(a,b){var c=a.x,h=a.y;a=a.z;var u=b.x,d=b.y;b=b.z;this.x=h*b-a*d;this.y=a*u-c*b;this.z=c*d-h*u;return this};e.prototype.angleTo=function(a){a=this.dot(a)/Math.sqrt(this.squaredLength()*a.squaredLength());return Math.acos(f.clamp(a,-1,1))};e.prototype.length=function(){return Math.sqrt(this.squaredLength())};e.prototype.squaredLength=function(){return this.dot(this)}; -e.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)};e.prototype.distanceTo=function(a){return Math.sqrt(this.squaredDistanceTo(a))};e.prototype.squaredDistanceTo=function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a};e.prototype.manhattanDistanceTo=function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)};e.prototype.normalize=function(){return this.divideScalar(this.length()||1)};e.prototype.applyMatrix4=function(a){var b= -this.x,c=this.y,h=this.z;a=a.elements;var u=1/(a[3]*b+a[7]*c+a[11]*h+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*h+a[12])*u;this.y=(a[1]*b+a[5]*c+a[9]*h+a[13])*u;this.z=(a[2]*b+a[6]*c+a[10]*h+a[14])*u;return this};e.prototype.applyRotation=function(a){var b=this.x,c=this.y,h=this.z,u=a.x,d=a.y,e=a.z;a=a.w;var r=a*b+d*h-e*c,f=a*c+e*b-u*h,g=a*h+u*c-d*b;b=-u*b-d*c-e*h;this.x=r*a+b*-u+f*-e-g*-d;this.y=f*a+b*-d+g*-u-r*-e;this.z=g*a+b*-e+r*-d-f*-u;return this};e.prototype.extractPositionFromMatrix=function(a){a= -a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this};e.prototype.transformDirection=function(a){var b=this.x,c=this.y,h=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*h;this.y=a[1]*b+a[5]*c+a[9]*h;this.z=a[2]*b+a[6]*c+a[10]*h;return this.normalize()};e.prototype.fromMatrix3Column=function(a,b){return this.fromArray(a.elements,3*b)};e.prototype.fromMatrix4Column=function(a,b){return this.fromArray(a.elements,4*b)};e.prototype.fromSpherical=function(a,b,c){var h=Math.sin(b)*a;this.x=h*Math.sin(c); -this.y=Math.cos(b)*a;this.z=h*Math.cos(c);return this};e.prototype.fromArray=function(a,b){b=void 0===b?0:b;this.x=a[b+0];this.y=a[b+1];this.z=a[b+2];return this};e.prototype.toArray=function(a,b){b=void 0===b?0:b;a[b+0]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a};e.prototype.equals=function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z};var H=new e(0,1,0),da=new e,ea=new e,Gb=new e,bb=new e,w=function(){this.elements=[1,0,0,0,1,0,0,0,1]};w.prototype.set=function(a,b,c,h,d,e,n,r,f){var u=this.elements; -u[0]=a;u[3]=b;u[6]=c;u[1]=h;u[4]=d;u[7]=e;u[2]=n;u[5]=r;u[8]=f;return this};w.prototype.copy=function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this};w.prototype.clone=function(){return(new this.constructor).copy(this)};w.prototype.identity=function(){this.set(1,0,0,0,1,0,0,0,1);return this};w.prototype.multiply=function(a){return this.multiplyMatrices(this,a)};w.prototype.premultiply=function(a){return this.multiplyMatrices(a, -this)};w.prototype.multiplyMatrices=function(a,b){var c=a.elements,h=b.elements;b=this.elements;a=c[0];var u=c[3],d=c[6],e=c[1],r=c[4],f=c[7],g=c[2],k=c[5];c=c[8];var l=h[0],m=h[3],J=h[6],cb=h[1],K=h[4],T=h[7],U=h[2],p=h[5];h=h[8];b[0]=a*l+u*cb+d*U;b[3]=a*m+u*K+d*p;b[6]=a*J+u*T+d*h;b[1]=e*l+r*cb+f*U;b[4]=e*m+r*K+f*p;b[7]=e*J+r*T+f*h;b[2]=g*l+k*cb+c*U;b[5]=g*m+k*K+c*p;b[8]=g*J+k*T+c*h;return this};w.prototype.multiplyScalar=function(a){var b=this.elements;b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*= -a;b[2]*=a;b[5]*=a;b[8]*=a;return this};w.prototype.extractBasis=function(a,b,c){a.fromMatrix3Column(this,0);b.fromMatrix3Column(this,1);c.fromMatrix3Column(this,2);return this};w.prototype.makeBasis=function(a,b,c){this.set(a.x,b.x,c.x,a.y,b.y,c.y,a.z,b.z,c.z);return this};w.prototype.lookAt=function(a,b,c){da.crossVectors(c,a).normalize();ea.crossVectors(H,b).normalize();0===ea.squaredLength()&&(bb.copy(b).addScalar(Number.EPSILON),ea.crossVectors(H,bb).normalize());Gb.crossVectors(b,ea).normalize(); -Hb.makeBasis(ea,Gb,b);Da.makeBasis(da,c,a);this.multiplyMatrices(Hb,Da.transpose());return this};w.prototype.transpose=function(){var a=this.elements;var b=a[1];a[1]=a[3];a[3]=b;b=a[2];a[2]=a[6];a[6]=b;b=a[5];a[5]=a[7];a[7]=b;return this};w.prototype.fromQuaternion=function(a){var b=this.elements,c=a.x,h=a.y,d=a.z,e=a.w,n=c+c,r=h+h,f=d+d;a=c*n;var g=c*r;c*=f;var k=h*r;h*=f;d*=f;n*=e;r*=e;e*=f;b[0]=1-(k+d);b[3]=g-e;b[6]=c+r;b[1]=g+e;b[4]=1-(a+d);b[7]=h-n;b[2]=c-r;b[5]=h+n;b[8]=1-(a+k);return this}; -w.prototype.fromArray=function(a,b){b=void 0===b?0:b;for(var c=this.elements,h=0;9>h;h++)c[h]=a[h+b];return this};w.prototype.toArray=function(a,b){b=void 0===b?0:b;var c=this.elements;a[b+0]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a};w.prototype.equals=function(a){var b=this.elements;a=a.elements;for(var c=0;9>c;c++)if(b[c]!==a[c])return!1;return!0};var Hb=new w,Da=new w,Ib=new w,t=function(a,b,c,h){this.x=void 0===a?0:a;this.y= -void 0===b?0:b;this.z=void 0===c?0:c;this.w=void 0===h?1:h};t.prototype.set=function(a,b,c,h){this.x=a;this.y=b;this.z=c;this.w=h;return this};t.prototype.copy=function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this};t.prototype.clone=function(){return(new this.constructor).copy(this)};t.prototype.inverse=function(){return this.conjugate().normalize()};t.prototype.conjugate=function(){this.x*=-1;this.y*=-1;this.z*=-1;return this};t.prototype.dot=function(a){return this.x*a.x+this.y*a.y+ -this.z*a.z+this.w*a.w};t.prototype.length=function(){return Math.sqrt(this.squaredLength())};t.prototype.squaredLength=function(){return this.dot(this)};t.prototype.normalize=function(){var a=this.length();0===a?(this.z=this.y=this.x=0,this.w=1):(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this};t.prototype.multiply=function(a){return this.multiplyQuaternions(this,a)};t.prototype.premultiply=function(a){return this.multiplyQuaternions(a,this)};t.prototype.multiplyQuaternions=function(a, -b){var c=a.x,h=a.y,d=a.z;a=a.w;var e=b.x,n=b.y,r=b.z;b=b.w;this.x=c*b+a*e+h*r-d*n;this.y=h*b+a*n+d*e-c*r;this.z=d*b+a*r+c*n-h*e;this.w=a*b-c*e-h*n-d*r;return this};t.prototype.angleTo=function(a){return 2*Math.acos(Math.abs(f.clamp(this.dot(a),-1,1)))};t.prototype.rotateTo=function(a,b){var c=this.angleTo(a);if(0===c)return this;this.slerp(a,Math.min(1,b/c));return this};t.prototype.lookAt=function(a,b,c){Ib.lookAt(a,b,c);this.fromMatrix3(Ib)};t.prototype.slerp=function(a,b){if(0===b)return this; +a:b+a}var f=function(){};f.clamp=function(a,b,c){return Math.max(b,Math.min(c,a))};f.randInt=function(a,b){return a+Math.floor(Math.random()*(b-a+1))};f.randFloat=function(a,b){return a+Math.random()*(b-a)};f.area=function(a,b,c){return(c.x-a.x)*(b.z-a.z)-(b.x-a.x)*(c.z-a.z)};var e=function(a,b,c){this.x=void 0===a?0:a;this.y=void 0===b?0:b;this.z=void 0===c?0:c};e.prototype.set=function(a,b,c){this.x=a;this.y=b;this.z=c;return this};e.prototype.copy=function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this}; +e.prototype.clone=function(){return(new this.constructor).copy(this)};e.prototype.add=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this};e.prototype.addScalar=function(a){this.x+=a;this.y+=a;this.z+=a;return this};e.prototype.addVectors=function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this};e.prototype.sub=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this};e.prototype.subScalar=function(a){this.x-=a;this.y-=a;this.z-=a;return this};e.prototype.subVectors=function(a, +b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this};e.prototype.multiply=function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this};e.prototype.multiplyScalar=function(a){this.x*=a;this.y*=a;this.z*=a;return this};e.prototype.multiplyVectors=function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this};e.prototype.divide=function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this};e.prototype.divideScalar=function(a){this.x/=a;this.y/=a;this.z/=a;return this};e.prototype.divideVectors= +function(a,b){this.x=a.x/b.x;this.y=a.y/b.y;this.z=a.z/b.z;return this};e.prototype.clamp=function(a,b){this.x=Math.max(a.x,Math.min(b.x,this.x));this.y=Math.max(a.y,Math.min(b.y,this.y));this.z=Math.max(a.z,Math.min(b.z,this.z));return this};e.prototype.min=function(a){this.x=Math.min(this.x,a.x);this.y=Math.min(this.y,a.y);this.z=Math.min(this.z,a.z);return this};e.prototype.max=function(a){this.x=Math.max(this.x,a.x);this.y=Math.max(this.y,a.y);this.z=Math.max(this.z,a.z);return this};e.prototype.dot= +function(a){return this.x*a.x+this.y*a.y+this.z*a.z};e.prototype.cross=function(a){var b=this.x,c=this.y,h=this.z;this.x=c*a.z-h*a.y;this.y=h*a.x-b*a.z;this.z=b*a.y-c*a.x;return this};e.prototype.crossVectors=function(a,b){var c=a.x,h=a.y;a=a.z;var u=b.x,d=b.y;b=b.z;this.x=h*b-a*d;this.y=a*u-c*b;this.z=c*d-h*u;return this};e.prototype.angleTo=function(a){a=this.dot(a)/Math.sqrt(this.squaredLength()*a.squaredLength());return Math.acos(f.clamp(a,-1,1))};e.prototype.length=function(){return Math.sqrt(this.squaredLength())}; +e.prototype.squaredLength=function(){return this.dot(this)};e.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)};e.prototype.distanceTo=function(a){return Math.sqrt(this.squaredDistanceTo(a))};e.prototype.squaredDistanceTo=function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a};e.prototype.manhattanDistanceTo=function(a){return Math.abs(this.x-a.x)+Math.abs(this.y-a.y)+Math.abs(this.z-a.z)};e.prototype.normalize=function(){return this.divideScalar(this.length()|| +1)};e.prototype.applyMatrix4=function(a){var b=this.x,c=this.y,h=this.z;a=a.elements;var u=1/(a[3]*b+a[7]*c+a[11]*h+a[15]);this.x=(a[0]*b+a[4]*c+a[8]*h+a[12])*u;this.y=(a[1]*b+a[5]*c+a[9]*h+a[13])*u;this.z=(a[2]*b+a[6]*c+a[10]*h+a[14])*u;return this};e.prototype.applyRotation=function(a){var b=this.x,c=this.y,h=this.z,u=a.x,d=a.y,e=a.z;a=a.w;var r=a*b+d*h-e*c,f=a*c+e*b-u*h,g=a*h+u*c-d*b;b=-u*b-d*c-e*h;this.x=r*a+b*-u+f*-e-g*-d;this.y=f*a+b*-d+g*-u-r*-e;this.z=g*a+b*-e+r*-d-f*-u;return this};e.prototype.extractPositionFromMatrix= +function(a){a=a.elements;this.x=a[12];this.y=a[13];this.z=a[14];return this};e.prototype.transformDirection=function(a){var b=this.x,c=this.y,h=this.z;a=a.elements;this.x=a[0]*b+a[4]*c+a[8]*h;this.y=a[1]*b+a[5]*c+a[9]*h;this.z=a[2]*b+a[6]*c+a[10]*h;return this.normalize()};e.prototype.fromMatrix3Column=function(a,b){return this.fromArray(a.elements,3*b)};e.prototype.fromMatrix4Column=function(a,b){return this.fromArray(a.elements,4*b)};e.prototype.fromSpherical=function(a,b,c){var h=Math.sin(b)*a; +this.x=h*Math.sin(c);this.y=Math.cos(b)*a;this.z=h*Math.cos(c);return this};e.prototype.fromArray=function(a,b){b=void 0===b?0:b;this.x=a[b+0];this.y=a[b+1];this.z=a[b+2];return this};e.prototype.toArray=function(a,b){b=void 0===b?0:b;a[b+0]=this.x;a[b+1]=this.y;a[b+2]=this.z;return a};e.prototype.equals=function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z};var H=new e(0,1,0),da=new e,ea=new e,Gb=new e,bb=new e,w=function(){this.elements=[1,0,0,0,1,0,0,0,1]};w.prototype.set=function(a,b,c, +h,d,e,n,r,f){var u=this.elements;u[0]=a;u[3]=b;u[6]=c;u[1]=h;u[4]=d;u[7]=e;u[2]=n;u[5]=r;u[8]=f;return this};w.prototype.copy=function(a){var b=this.elements;a=a.elements;b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return this};w.prototype.clone=function(){return(new this.constructor).copy(this)};w.prototype.identity=function(){this.set(1,0,0,0,1,0,0,0,1);return this};w.prototype.multiply=function(a){return this.multiplyMatrices(this,a)};w.prototype.premultiply= +function(a){return this.multiplyMatrices(a,this)};w.prototype.multiplyMatrices=function(a,b){var c=a.elements,h=b.elements;b=this.elements;a=c[0];var u=c[3],d=c[6],e=c[1],r=c[4],f=c[7],g=c[2],k=c[5];c=c[8];var l=h[0],m=h[3],J=h[6],cb=h[1],K=h[4],T=h[7],U=h[2],p=h[5];h=h[8];b[0]=a*l+u*cb+d*U;b[3]=a*m+u*K+d*p;b[6]=a*J+u*T+d*h;b[1]=e*l+r*cb+f*U;b[4]=e*m+r*K+f*p;b[7]=e*J+r*T+f*h;b[2]=g*l+k*cb+c*U;b[5]=g*m+k*K+c*p;b[8]=g*J+k*T+c*h;return this};w.prototype.multiplyScalar=function(a){var b=this.elements; +b[0]*=a;b[3]*=a;b[6]*=a;b[1]*=a;b[4]*=a;b[7]*=a;b[2]*=a;b[5]*=a;b[8]*=a;return this};w.prototype.extractBasis=function(a,b,c){a.fromMatrix3Column(this,0);b.fromMatrix3Column(this,1);c.fromMatrix3Column(this,2);return this};w.prototype.makeBasis=function(a,b,c){this.set(a.x,b.x,c.x,a.y,b.y,c.y,a.z,b.z,c.z);return this};w.prototype.lookAt=function(a,b,c){da.crossVectors(c,a).normalize();ea.crossVectors(H,b).normalize();0===ea.squaredLength()&&(bb.copy(b).addScalar(Number.EPSILON),ea.crossVectors(H, +bb).normalize());Gb.crossVectors(b,ea).normalize();Hb.makeBasis(ea,Gb,b);Da.makeBasis(da,c,a);this.multiplyMatrices(Hb,Da.transpose());return this};w.prototype.transpose=function(){var a=this.elements;var b=a[1];a[1]=a[3];a[3]=b;b=a[2];a[2]=a[6];a[6]=b;b=a[5];a[5]=a[7];a[7]=b;return this};w.prototype.fromQuaternion=function(a){var b=this.elements,c=a.x,h=a.y,d=a.z,e=a.w,n=c+c,r=h+h,f=d+d;a=c*n;var g=c*r;c*=f;var k=h*r;h*=f;d*=f;n*=e;r*=e;e*=f;b[0]=1-(k+d);b[3]=g-e;b[6]=c+r;b[1]=g+e;b[4]=1-(a+d);b[7]= +h-n;b[2]=c-r;b[5]=h+n;b[8]=1-(a+k);return this};w.prototype.fromArray=function(a,b){b=void 0===b?0:b;for(var c=this.elements,h=0;9>h;h++)c[h]=a[h+b];return this};w.prototype.toArray=function(a,b){b=void 0===b?0:b;var c=this.elements;a[b+0]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];return a};w.prototype.equals=function(a){var b=this.elements;a=a.elements;for(var c=0;9>c;c++)if(b[c]!==a[c])return!1;return!0};var Hb=new w,Da=new w,Ib=new w,t= +function(a,b,c,h){this.x=void 0===a?0:a;this.y=void 0===b?0:b;this.z=void 0===c?0:c;this.w=void 0===h?1:h};t.prototype.set=function(a,b,c,h){this.x=a;this.y=b;this.z=c;this.w=h;return this};t.prototype.copy=function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this};t.prototype.clone=function(){return(new this.constructor).copy(this)};t.prototype.inverse=function(){return this.conjugate().normalize()};t.prototype.conjugate=function(){this.x*=-1;this.y*=-1;this.z*=-1;return this};t.prototype.dot= +function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w};t.prototype.length=function(){return Math.sqrt(this.squaredLength())};t.prototype.squaredLength=function(){return this.dot(this)};t.prototype.normalize=function(){var a=this.length();0===a?(this.z=this.y=this.x=0,this.w=1):(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this};t.prototype.multiply=function(a){return this.multiplyQuaternions(this,a)};t.prototype.premultiply=function(a){return this.multiplyQuaternions(a,this)};t.prototype.multiplyQuaternions= +function(a,b){var c=a.x,h=a.y,d=a.z;a=a.w;var e=b.x,n=b.y,r=b.z;b=b.w;this.x=c*b+a*e+h*r-d*n;this.y=h*b+a*n+d*e-c*r;this.z=d*b+a*r+c*n-h*e;this.w=a*b-c*e-h*n-d*r;return this};t.prototype.angleTo=function(a){return 2*Math.acos(Math.abs(f.clamp(this.dot(a),-1,1)))};t.prototype.rotateTo=function(a,b){var c=this.angleTo(a);if(0===c)return this;this.slerp(a,Math.min(1,b/c));return this};t.prototype.lookAt=function(a,b,c){Ib.lookAt(a,b,c);this.fromMatrix3(Ib)};t.prototype.slerp=function(a,b){if(0===b)return this; if(1===b)return this.copy(a);var c=this.x,h=this.y,d=this.z,e=this.w,n=e*a.w+c*a.x+h*a.y+d*a.z;0>n?(this.w=-a.w,this.x=-a.x,this.y=-a.y,this.z=-a.z,n=-n):this.copy(a);if(1<=n)return this.w=e,this.x=c,this.y=h,this.z=d,this;a=Math.sqrt(1-n*n);if(.001>Math.abs(a))return this.w=.5*(e+this.w),this.x=.5*(c+this.x),this.y=.5*(h+this.y),this.z=.5*(d+this.z),this;var r=Math.atan2(a,n);n=Math.sin((1-b)*r)/a;b=Math.sin(b*r)/a;this.w=e*n+this.w*b;this.x=c*n+this.x*b;this.y=h*n+this.y*b;this.z=d*n+this.z*b;return this}; t.prototype.fromEuler=function(a,b,c){var h=Math.cos(a/2),d=Math.cos(b/2),e=Math.cos(c/2);a=Math.sin(a/2);b=Math.sin(b/2);c=Math.sin(c/2);this.x=a*d*e+h*b*c;this.y=h*b*e-a*d*c;this.z=h*d*c+a*b*e;this.w=h*d*e-a*b*c;return this};t.prototype.fromMatrix3=function(a){var b=a.elements,c=b[0];a=b[3];var h=b[6],d=b[1],e=b[4],n=b[7],r=b[2],f=b[5];b=b[8];var g=c+e+b;0e&&c>b?(c=2*Math.sqrt(1+c-e-b),this.w=(f-n)/c,this.x=.25* c,this.y=(a+d)/c,this.z=(h+r)/c):e>b?(c=2*Math.sqrt(1+e-c-b),this.w=(h-r)/c,this.x=(a+d)/c,this.y=.25*c,this.z=(n+f)/c):(c=2*Math.sqrt(1+b-c-e),this.w=(d-a)/c,this.x=(h+r)/c,this.y=(n+f)/c,this.z=.25*c);return this};t.prototype.fromArray=function(a,b){b=void 0===b?0:b;this.x=a[b+0];this.y=a[b+1];this.z=a[b+2];this.w=a[b+3];return this};t.prototype.toArray=function(a,b){b=void 0===b?0:b;a[b+0]=this.x;a[b+1]=this.y;a[b+2]=this.z;a[b+3]=this.w;return a};t.prototype.equals=function(a){return a.x===this.x&& diff --git a/build/yuka.module.js b/build/yuka.module.js index 649cdc31..b184b42c 100644 --- a/build/yuka.module.js +++ b/build/yuka.module.js @@ -19,6 +19,19 @@ class MathUtils { } + /** + * Computes a random integer value within a given min/max range. + * + * @param {min} value - The min value. + * @param {max} value - The max value. + * @return {Number} The random integer value. + */ + static randInt( min, max ) { + + return min + Math.floor( Math.random() * ( max - min + 1 ) ); + + } + /** * Computes a random float value within a given min/max range. * diff --git a/examples/entity/shooter/audio/impact1.ogg b/examples/entity/shooter/audio/impact1.ogg new file mode 100644 index 0000000000000000000000000000000000000000..d11f503d986db5162044cc4bffb6153dda7241bb GIT binary patch literal 10973 zcmb_?Wmr^S*Z08!R6+z9DM4~TVn}HTiJ^1|2|;1#l#U@(kOq-1L1O5TngJ;V>5>{6 zRJx@F1fDZ^|L^;L-Vg8fet6GyW@hcPV(;}^Yp=b}Iiq1=p$S|7{&o1A@mx{~b{CqHeK7Kv{Mh*=-d#e{tX3l2zF3^jh_%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-<-E{*0YBkCRQgV2164+cCRR! tNap(Z&L<5|N#0%>A9Gb@&&1f++OuEqEs_{6^QC+_B%zq|r9ocwe*mxJ0X+Z! literal 0 HcmV?d00001 diff --git a/examples/entity/shooter/index.html b/examples/entity/shooter/index.html index 7b79476f..f62a3994 100644 --- a/examples/entity/shooter/index.html +++ b/examples/entity/shooter/index.html @@ -177,12 +177,20 @@ const step2 = new THREE.Audio( listener ); const shot = new THREE.PositionalAudio( listener ); const reload = new THREE.PositionalAudio( listener ); + const impact1 = new THREE.PositionalAudio( listener ); + const impact2 = new THREE.PositionalAudio( listener ); + const impact3 = new THREE.PositionalAudio( listener ); + + shot.setVolume( 0.3 ); reload.setVolume( 0.3 ); audioLoader.load( 'audio/step1.ogg', ( buffer ) => { step1.setBuffer( buffer ) } ); audioLoader.load( 'audio/step2.ogg', ( buffer ) => { step2.setBuffer( buffer ) } ); audioLoader.load( 'audio/shot.ogg', ( buffer ) => { shot.setBuffer( buffer ) } ); audioLoader.load( 'audio/reload.ogg', ( buffer ) => { reload.setBuffer( buffer ) } ); + audioLoader.load( 'audio/impact1.ogg', ( buffer ) => { impact1.setBuffer( buffer ) } ); + audioLoader.load( 'audio/impact2.ogg', ( buffer ) => { impact2.setBuffer( buffer ) } ); + audioLoader.load( 'audio/impact3.ogg', ( buffer ) => { impact3.setBuffer( buffer ) } ); // @@ -217,6 +225,9 @@ player.head.setRenderComponent( camera, syncCamera ); player.weapon.sounds.set( 'shot', shot ); player.weapon.sounds.set( 'reload', reload ); + player.weapon.sounds.set( 'impact1', impact1 ); + player.weapon.sounds.set( 'impact2', impact2 ); + player.weapon.sounds.set( 'impact3', impact3 ); controls = new FirstPersonControls( player ); controls.lookSpeed = 2; diff --git a/examples/entity/shooter/src/Bullet.js b/examples/entity/shooter/src/Bullet.js index aff60d77..b7c6f911 100644 --- a/examples/entity/shooter/src/Bullet.js +++ b/examples/entity/shooter/src/Bullet.js @@ -2,7 +2,7 @@ * @author Mugen87 / https://github.com/Mugen87 */ -import { Projectile, Ray, Vector3 } from '../../../../build/yuka.module.js'; +import { Projectile, MathUtils, Ray, Vector3 } from '../../../../build/yuka.module.js'; import world from './World.js'; const intersectionPoint = new Vector3(); @@ -53,9 +53,14 @@ class Bullet extends Projectile { if ( distanceToIntersction <= validDistance ) { + const audio = this.owner.weapon.sounds.get( 'impact' + MathUtils.randInt( 1, 3 ) ); + + if ( audio.isPlaying === true ) audio.stop(); + audio.play(); + // hit! - world.addBulletHole( intersectionPoint, normal ); + world.addBulletHole( intersectionPoint, normal, audio ); // TODO: inform game entity about hit. need referene to game entity diff --git a/examples/entity/shooter/src/World.js b/examples/entity/shooter/src/World.js index 7138d05c..3f5e0669 100644 --- a/examples/entity/shooter/src/World.js +++ b/examples/entity/shooter/src/World.js @@ -76,9 +76,10 @@ class World { } - addBulletHole( position, normal ) { + addBulletHole( position, normal, audio ) { const bulletHole = this.renderComponents.get( 'bulletHole' ).clone(); + bulletHole.add( audio ); const s = 1 + ( Math.random() * 0.5 ); bulletHole.scale.set( s, s, s ); diff --git a/src/math/MathUtils.js b/src/math/MathUtils.js index 18cfaf91..c9e00b0a 100644 --- a/src/math/MathUtils.js +++ b/src/math/MathUtils.js @@ -19,6 +19,19 @@ class MathUtils { } + /** + * Computes a random integer value within a given min/max range. + * + * @param {min} value - The min value. + * @param {max} value - The max value. + * @return {Number} The random integer value. + */ + static randInt( min, max ) { + + return min + Math.floor( Math.random() * ( max - min + 1 ) ); + + } + /** * Computes a random float value within a given min/max range. * diff --git a/test/unit_test/math/MathUtils.tests.js b/test/unit_test/math/MathUtils.tests.js index 7db64d4c..c13da637 100644 --- a/test/unit_test/math/MathUtils.tests.js +++ b/test/unit_test/math/MathUtils.tests.js @@ -22,9 +22,27 @@ describe( 'Math', function () { } ); + describe( '#randInt()', function () { + + it( 'should return a random integer between two integer values', function () { + + let int = MathUtils.randInt( 4, 6 ); + + expect( int ).to.be.within( 4, 6 ); + expect( int % 1 ).to.equal( 0 ); + + int = MathUtils.randInt( - 2, 0 ); + + expect( int ).to.be.within( - 2, 0 ); + expect( int % 1 ).to.equal( 0 ); + + } ); + + } ); + describe( '#randFloat()', function () { - it( 'should return a random number between two float values', function () { + it( 'should return a random float between two float values', function () { expect( MathUtils.randFloat( 4, 6 ) ).to.be.within( 4, 6 ); expect( MathUtils.randFloat( - 2, - 1 ) ).to.be.within( - 2, - 1 );