Ignore:
Timestamp:
2014-12-15T13:07:02+13:00 (9 years ago)
Author:
bmt11
Message:

All weather is now functioning including switching back to fine weather. Weather is now also affected by wind force

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/nz-flag-design/trunk/render-3d/weather/rain.js

    r29475 r29634  
    33   
    44    this.isInit = false;
     5    this.MASS = 0.01;
    56   
    67    this.init = function() {
     
    1314   
    1415        // create the particle variables
    15         this.particleCount = 1800,
     16        this.particleCount = 3500,
    1617        this.particles = new THREE.Geometry(),
    1718        this.pMaterial = new THREE.ParticleBasicMaterial({
     
    3132            // create a particle with random
    3233            // position values, -250 -> 250
    33             var pX = Math.random() * window.innerWidth * 2 - window.innerWidth,
    34                 pY = Math.random() * window.innerHeight * 3 - window.innerHeight,
    35                 pZ = Math.random() * window.innerWidth * 2 - window.innerWidth;
    36                 this.particle = new THREE.Vector3(pX, pY, pZ);
     34            var pX = (Math.random() * 3000) - 1500,
     35                pY = Math.random() * window.innerHeight * 3 - window.innerHeight,
     36                pZ = (Math.random() * 3000) - 1500;
     37                this.particle = new THREE.Vector3(pX, pY, pZ); 
    3738
    3839            // create a velocity vector
    39             this.particle.velocity = new THREE.Vector3(
    40                 0, // x
    41                 -Math.random(), // y
    42                 0); // z
     40            this.particle.velocity = new THREE.Vector3(
     41                (windForce.x * this.MASS), // x
     42                -Math.random() * 0.01, // y
     43                (windForce.z * this.MASS)); // z
    4344
    4445            // add it to the geometry
     
    7071           
    7172            // check if we need to reset
    72             if(this.particle.y < -200) {
    73                 this.particle.y = Math.random() * window.innerHeight+10;
     73            if(this.particle.y < -10) {
     74                this.particle.y = (window.innerHeight*2)+(Math.random() * 100);
    7475                this.particle.velocity.y = 0;
     76                this.particle.x = (Math.random() * 4000) - 2000;
     77                this.particle.z = (Math.random() * 4000) - 2000;
     78
    7579            }
    7680           
    7781            // update the velocity
    78             this.particle.velocity.y -= Math.random() * .1;
     82            this.particle.velocity.y -= Math.random() * 0.01;
    7983           
    8084            // and the position
Note: See TracChangeset for help on using the changeset viewer.