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/snow.js

    r29547 r29634  
    33   
    44        this.isInit = false;
    5         this.Mass = 0.01;
     5        this.MASS = 0.005;
    66       
    77        this.init = function() {
     
    1414       
    1515            // create the particle variables
    16             this.particleCount = 2000,
     16            this.particleCount = 3000,
    1717            this.particles = new THREE.Geometry(),
    1818           
     
    3232
    3333                // create a particle with random
    34                 // position values, -250 -> 250
    35                 var pX = Math.random() * window.innerWidth * 3 - window.innerWidth,
    36                     pY = Math.random() * window.innerHeight * 4 - window.innerHeight,
    37                     pZ = Math.random() * window.innerWidth * 3 - window.innerWidth;
     34                // position values
     35                var pX = (Math.random() * 3000) - 1500,
     36                    pY = Math.random() * window.innerHeight * 3 - window.innerHeight,
     37                    pZ = (Math.random() * 3000) - 1500;
    3838                    this.particle = new THREE.Vector3(pX, pY, pZ); 
    3939               
    4040                // create a velocity vector
    4141                this.particle.velocity = new THREE.Vector3(
    42                     0, // x
    43                     -Math.random(), // y
    44                     0); // z
    45 
     42                    (windForce.x * this.MASS), // x
     43                    -Math.random() * 0.01, // y
     44                    (windForce.z * this.MASS)); // z
     45               
     46                //this.particle.velocity.z = arrow.direction.z * this.MASS;
    4647                // add it to the geometry
    4748                this.particles.vertices.push(this.particle);
     
    7374               
    7475                // check if we need to reset
    75                 if(this.particle.y < -200) {
    76                     this.particle.y = Math.random() * window.innerHeight+10;
     76                if(this.particle.y < -10) {
     77                    this.particle.y = (window.innerHeight*2)+(Math.random() * 100);
    7778                    this.particle.velocity.y = 0;
     79                    this.particle.x = (Math.random() * 4000) - 2000;
     80                    this.particle.z = (Math.random() * 4000) - 2000;
     81
    7882                }
    7983               
    8084                // update the velocity
    81                 this.particle.velocity.y -= Math.random() * this.Mass;
    82                
     85                this.particle.velocity.y -= Math.random() * 0.001;
     86                //this.particle.velocity.x = (windForce.x * this.MASS);
     87                //this.particle.velocity.z = (windForce.z * this.MASS);
     88
    8389                // and the position
    8490                this.particle.addVectors(
Note: See TracChangeset for help on using the changeset viewer.