Created
September 15, 2014 18:43
-
-
Save cozza13/e01a592125742dbd39cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// EntityRain.js | |
// | |
// Created by Richard Gunther on 15-09-2014. | |
// Distributed under the Apache License, Version 2.0. | |
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | |
// | |
var startpos = {x: 115, y: 180, z: 130}; | |
var areaSize = 20; | |
var pitch = 90.0; | |
var yaw = 0.0; | |
var roll = 180.0; | |
var rotation = Quat.fromPitchYawRollDegrees(pitch, yaw, roll) | |
var rainDropX; | |
var rainDropZ; | |
var deltaCount = 0; | |
function rainEntity(deltaTime) | |
{ | |
if (deltaCount == 5) | |
{ | |
deltaCount=0; | |
rainDropX = Math.random() * areaSize + 1; | |
rainDropZ = Math.random() * areaSize + 1; | |
originalProperties = | |
{ | |
type: "Sphere", | |
position: { x: startpos.x + rainDropX, | |
y: startpos.y, | |
z: startpos.z + rainDropZ }, | |
dimensions: { x: 0.05, | |
y: 0.05, | |
z: 0.15}, | |
color: { red: 255, | |
green: 255, | |
blue: 255 }, | |
rotation: rotation, | |
gravity: { x: 0.00, | |
y: -9.6, | |
z: 0 }, | |
lifetime: 10.0 | |
} | |
Entities.addEntity(originalProperties); | |
entitycount++; | |
} | |
deltaCount++; | |
} | |
Script.update.connect(rainEntity); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment