Needs a lot of cleanup. Data has been de-duplicated, and where identical copies existed, one of them has been replaced with a symlink. Some files have been excluded, such as binaries, installers and debug dumps. Some of that may still be present.
45 lines
No EOL
1.3 KiB
JavaScript
45 lines
No EOL
1.3 KiB
JavaScript
//
|
|
// tuscanyfountain.js
|
|
// examples
|
|
//
|
|
// Created by Philip Rosedale on December 16, 2014
|
|
// Copyright 2014 High Fidelity, Inc.
|
|
//
|
|
// Creates a fountain of blue spheres that shoot upward from a starting point and fall.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
var fountainCenter = { x: 2165.96, y: 1887.36, z: 3743.58 };
|
|
|
|
function newDroplet() {
|
|
var LATERAL_VELOCITY = 0.9;
|
|
var UPWARD_VELOCITY = 1.5;
|
|
var GRAVITY = -1.5;
|
|
var DAMPING = 0.99;
|
|
var RADIUS = 0.07;
|
|
var LIFETIME = 2.0;
|
|
var radius = (Math.random() + 0.3) * RADIUS;
|
|
var properties = {
|
|
type: "Sphere",
|
|
position: fountainCenter,
|
|
dimensions: { x: radius, y: radius, z: radius },
|
|
gravity: { x: 0, y: GRAVITY, z: 0 },
|
|
velocity: { x: (Math.random() - 0.5) * LATERAL_VELOCITY, y: (Math.random() + 0.25) * UPWARD_VELOCITY, z: (Math.random() - 0.5) * LATERAL_VELOCITY },
|
|
damping: DAMPING,
|
|
color: { red: 0, green: 0, blue : 100 + Math.random() * 155 },
|
|
lifetime: LIFETIME,
|
|
collisionsWillMove: false,
|
|
ignoreCollisions: true
|
|
};
|
|
Entities.addEntity(properties);
|
|
}
|
|
|
|
function update(deltaTime) {
|
|
if (Math.random() < 0.1) {
|
|
newDroplet();
|
|
}
|
|
}
|
|
|
|
Script.update.connect(update); |