Set raindrops falling

This commit is contained in:
David Rowe 2015-04-09 17:29:14 -07:00
parent 66ea84977a
commit 54980f46a9

View file

@ -13,9 +13,10 @@ var RainSquall = function (properties) {
var // Properties var // Properties
squallOrigin, squallOrigin,
squallRadius, squallRadius,
dropSize = { x: 0.1, y: 0.1, z: 0.1 },
dropLifetime = 60, // Seconds
dropsPerMinute = 60, dropsPerMinute = 60,
dropSize = { x: 0.1, y: 0.1, z: 0.1 },
dropFallSpeed = 1, // m/s
dropLifetime = 60, // Seconds
debug = false, // Display origin circle debug = false, // Display origin circle
// Other // Other
squallCircle, squallCircle,
@ -39,16 +40,20 @@ var RainSquall = function (properties) {
} }
squallRadius = properties.radius; squallRadius = properties.radius;
if (properties.hasOwnProperty("dropsPerMinute")) {
dropsPerMinute = properties.dropsPerMinute;
}
if (properties.hasOwnProperty("dropSize")) { if (properties.hasOwnProperty("dropSize")) {
dropSize = properties.dropSize; dropSize = properties.dropSize;
} }
if (properties.hasOwnProperty("dropLifetime")) { if (properties.hasOwnProperty("dropFallSpeed")) {
dropLifetime = properties.dropLifetime; dropFallSpeed = properties.dropFallSpeed;
} }
if (properties.hasOwnProperty("dropsPerMinute")) { if (properties.hasOwnProperty("dropLifetime")) {
dropsPerMinute = properties.dropsPerMinute; dropLifetime = properties.dropLifetime;
} }
if (properties.hasOwnProperty("debug")) { if (properties.hasOwnProperty("debug")) {
@ -59,7 +64,10 @@ var RainSquall = function (properties) {
type: "Model", type: "Model",
modelURL: RAINDROP_MODEL_URL, modelURL: RAINDROP_MODEL_URL,
lifetime: dropLifetime, lifetime: dropLifetime,
dimensions: dropSize dimensions: dropSize,
velocity: { x: 0, y: -dropFallSpeed, z: 0 },
damping: 0,
ignoreForCollisions: true
}; };
} }
@ -67,6 +75,7 @@ var RainSquall = function (properties) {
var angle, var angle,
radius, radius,
offset; offset;
angle = Math.random() * 360; angle = Math.random() * 360;
radius = Math.random() * squallRadius; radius = Math.random() * squallRadius;
offset = Vec3.multiplyQbyV(Quat.fromPitchYawRollDegrees(0, angle, 0), { x: 0, y: -0.1, z: radius }); offset = Vec3.multiplyQbyV(Quat.fromPitchYawRollDegrees(0, angle, 0), { x: 0, y: -0.1, z: radius });
@ -104,8 +113,9 @@ var RainSquall = function (properties) {
var rainSquall1 = new RainSquall({ var rainSquall1 = new RainSquall({
origin: { x: 8192, y: 8200, z: 8192 }, origin: { x: 8192, y: 8200, z: 8192 },
radius: 2.5, radius: 2.5,
dropSize: { x: 0.1, y: 0.1, z: 0.1 },
dropLifetime: 10,
dropsPerMinute: 120, dropsPerMinute: 120,
dropSize: { x: 0.1, y: 0.1, z: 0.1 },
dropFallSpeed: 2, // m/s
dropLifetime: 10,
debug: true debug: true
}); });