mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 20:16:16 +02:00
adding rave stick
This commit is contained in:
parent
4155e3af71
commit
6a77ae5db2
4 changed files with 145 additions and 120 deletions
|
@ -15,10 +15,12 @@
|
||||||
|
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("../../libraries/utils.js");
|
||||||
Script.include("lightBall/LightBall.js");
|
Script.include("lightBall/LightBall.js");
|
||||||
|
Script.include("raveStick/RaveStick.js");
|
||||||
|
|
||||||
var basePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
var basePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
||||||
basePosition.y = MyAvatar.position.y + 1
|
basePosition.y = MyAvatar.position.y + 1;
|
||||||
var lightBall = LightBall(basePosition);
|
var lightBall = new LightBall(basePosition);
|
||||||
|
var raveStick = new RaveStick(Vec3.sum(basePosition, {x: 1, y: 1, z: 1}));
|
||||||
var modelURL = "file:///C:/Users/Eric/Desktop/RaveRoom.fbx?v1" + Math.random();
|
var modelURL = "file:///C:/Users/Eric/Desktop/RaveRoom.fbx?v1" + Math.random();
|
||||||
|
|
||||||
var roomDimensions = {x: 30.58, y: 15.29, z: 30.58};
|
var roomDimensions = {x: 30.58, y: 15.29, z: 30.58};
|
||||||
|
@ -41,8 +43,6 @@ var floor = Entities.addEntity({
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var lightZone = Entities.addEntity({
|
var lightZone = Entities.addEntity({
|
||||||
type: "Zone",
|
type: "Zone",
|
||||||
shapeType: 'box',
|
shapeType: 'box',
|
||||||
|
@ -68,6 +68,7 @@ function cleanup() {
|
||||||
Entities.deleteEntity(lightZone)
|
Entities.deleteEntity(lightZone)
|
||||||
Entities.deleteEntity(floor);
|
Entities.deleteEntity(floor);
|
||||||
lightBall.cleanup();
|
lightBall.cleanup();
|
||||||
|
raveStick.cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
Script.scriptEnding.connect(cleanup);
|
Script.scriptEnding.connect(cleanup);
|
|
@ -1,124 +1,124 @@
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("../../libraries/utils.js");
|
||||||
|
|
||||||
LightBall = function(basePosition) {
|
LightBall = function(spawnPosition) {
|
||||||
|
|
||||||
var colorPalette = [{
|
var colorPalette = [{
|
||||||
|
red: 25,
|
||||||
|
green: 20,
|
||||||
|
blue: 162
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
var containerBall = Entities.addEntity({
|
||||||
|
type: "Sphere",
|
||||||
|
position: Vec3.sum(spawnPosition, {
|
||||||
|
x: 0,
|
||||||
|
y: .5,
|
||||||
|
z: 0
|
||||||
|
}),
|
||||||
|
dimensions: {
|
||||||
|
x: .1,
|
||||||
|
y: .1,
|
||||||
|
z: .1
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
red: 15,
|
||||||
|
green: 10,
|
||||||
|
blue: 150
|
||||||
|
},
|
||||||
|
collisionsWillMove: true,
|
||||||
|
userData: JSON.stringify({
|
||||||
|
grabbableKey: {
|
||||||
|
spatialKey: {
|
||||||
|
relativePosition: {
|
||||||
|
x: 0,
|
||||||
|
y: .7,
|
||||||
|
z: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
invertSolidWhileHeld: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var light = Entities.addEntity({
|
||||||
|
type: 'Light',
|
||||||
|
parentID: containerBall,
|
||||||
|
dimensions: {
|
||||||
|
x: 30,
|
||||||
|
y: 30,
|
||||||
|
z: 30
|
||||||
|
},
|
||||||
|
color: colorPalette[randInt(0, colorPalette.length)],
|
||||||
|
intensity: 5
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var lightBall = Entities.addEntity({
|
||||||
|
type: "ParticleEffect",
|
||||||
|
parentID: containerBall,
|
||||||
|
isEmitting: true,
|
||||||
|
"name": "ParticlesTest Emitter",
|
||||||
|
"colorStart": {
|
||||||
|
red: 200,
|
||||||
|
green: 20,
|
||||||
|
blue: 40
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
red: 200,
|
||||||
|
green: 200,
|
||||||
|
blue: 255
|
||||||
|
},
|
||||||
|
"colorFinish": {
|
||||||
red: 25,
|
red: 25,
|
||||||
green: 20,
|
green: 20,
|
||||||
blue: 162
|
blue: 255
|
||||||
}];
|
},
|
||||||
|
"maxParticles": 100000,
|
||||||
|
"lifespan": 2,
|
||||||
var containerBall = Entities.addEntity({
|
"emitRate": 10000,
|
||||||
type: "Sphere",
|
"emitSpeed": .1,
|
||||||
position: Vec3.sum(basePosition, {
|
"speedSpread": 0.0,
|
||||||
x: 0,
|
"emitDimensions": {
|
||||||
y: .5,
|
"x": 0,
|
||||||
z: 0
|
"y": 0,
|
||||||
}),
|
"z": 0
|
||||||
dimensions: {
|
},
|
||||||
x: .1,
|
"polarStart": 0,
|
||||||
y: .1,
|
"polarFinish": Math.PI,
|
||||||
z: .1
|
"azimuthStart": -Math.PI,
|
||||||
},
|
"azimuthFinish": Math.PI,
|
||||||
color: {
|
"emitAcceleration": {
|
||||||
red: 15,
|
"x": 0,
|
||||||
green: 10,
|
"y": 0,
|
||||||
blue: 150
|
"z": 0
|
||||||
},
|
},
|
||||||
collisionsWillMove: true,
|
"accelerationSpread": {
|
||||||
userData: JSON.stringify({
|
"x": .00,
|
||||||
grabbableKey: {
|
"y": .00,
|
||||||
spatialKey: {
|
"z": .00
|
||||||
relativePosition: {
|
},
|
||||||
x: 0,
|
"particleRadius": 0.02,
|
||||||
y: 1,
|
"radiusSpread": 0,
|
||||||
z: 0
|
"radiusStart": 0.03,
|
||||||
}
|
"radiusFinish": 0.0003,
|
||||||
},
|
"alpha": 0,
|
||||||
invertSolidWhileHeld: true
|
"alphaSpread": .5,
|
||||||
}
|
"alphaStart": 0,
|
||||||
})
|
"alphaFinish": 0.5,
|
||||||
});
|
// "textures": "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
|
||||||
|
"textures": "file:///C:/Users/Eric/Desktop/Particle-Sprite-Smoke-1.png?v1" + Math.random(),
|
||||||
|
emitterShouldTrail: true
|
||||||
var light = Entities.addEntity({
|
})
|
||||||
type: 'Light',
|
|
||||||
parentID: containerBall,
|
|
||||||
dimensions: {
|
|
||||||
x: 30,
|
|
||||||
y: 30,
|
|
||||||
z: 30
|
|
||||||
},
|
|
||||||
color: colorPalette[randInt(0, colorPalette.length)],
|
|
||||||
intensity: 5
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
var lightBall = Entities.addEntity({
|
|
||||||
type: "ParticleEffect",
|
|
||||||
parentID: containerBall,
|
|
||||||
isEmitting: true,
|
|
||||||
"name": "ParticlesTest Emitter",
|
|
||||||
"colorStart": {
|
|
||||||
red: 200,
|
|
||||||
green: 20,
|
|
||||||
blue: 40
|
|
||||||
},
|
|
||||||
color: {
|
|
||||||
red: 200,
|
|
||||||
green: 200,
|
|
||||||
blue: 255
|
|
||||||
},
|
|
||||||
"colorFinish": {
|
|
||||||
red: 25,
|
|
||||||
green: 20,
|
|
||||||
blue: 255
|
|
||||||
},
|
|
||||||
"maxParticles": 100000,
|
|
||||||
"lifespan": 5,
|
|
||||||
"emitRate": 5000,
|
|
||||||
"emitSpeed": .1,
|
|
||||||
"speedSpread": 0.0,
|
|
||||||
"emitDimensions": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"polarStart": 0,
|
|
||||||
"polarFinish": Math.PI,
|
|
||||||
"azimuthStart": -Math.PI,
|
|
||||||
"azimuthFinish": Math.PI,
|
|
||||||
"emitAcceleration": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0,
|
|
||||||
"z": 0
|
|
||||||
},
|
|
||||||
"accelerationSpread": {
|
|
||||||
"x": .00,
|
|
||||||
"y": .00,
|
|
||||||
"z": .00
|
|
||||||
},
|
|
||||||
"particleRadius": 0.04,
|
|
||||||
"radiusSpread": 0,
|
|
||||||
"radiusStart": 0.05,
|
|
||||||
"radiusFinish": 0.0003,
|
|
||||||
"alpha": 0,
|
|
||||||
"alphaSpread": .5,
|
|
||||||
"alphaStart": 0,
|
|
||||||
"alphaFinish": 0.5,
|
|
||||||
// "textures": "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
|
|
||||||
"textures": "file:///C:/Users/Eric/Desktop/Particle-Sprite-Smoke-1.png?v1" + Math.random(),
|
|
||||||
emitterShouldTrail: true
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
Entities.deleteEntity(lightBall);
|
Entities.deleteEntity(lightBall);
|
||||||
Entities.deleteEntity(containerBall);
|
Entities.deleteEntity(containerBall);
|
||||||
Entities.deleteEntity(light);
|
Entities.deleteEntity(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cleanup = cleanup;
|
this.cleanup = cleanup;
|
||||||
}
|
}
|
24
examples/flowArts/raveStick/RaveStick.js
Normal file
24
examples/flowArts/raveStick/RaveStick.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
Script.include("../../libraries/utils.js");
|
||||||
|
var modelURL = "file:///C:/Users/Eric/Desktop/raveStick.fbx?v1" + Math.random();
|
||||||
|
|
||||||
|
RaveStick = function(spawnPosition) {
|
||||||
|
|
||||||
|
var stick = Entities.addEntity({
|
||||||
|
type: "Model",
|
||||||
|
modelURL: modelURL,
|
||||||
|
position: spawnPosition,
|
||||||
|
shapeType: 'box',
|
||||||
|
userData: JSON.stringify({
|
||||||
|
grabbableKey: {
|
||||||
|
invertSolidWhileHeld: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function cleanup() {
|
||||||
|
Entities.deleteEntity(stick);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cleanup = cleanup;
|
||||||
|
}
|
Loading…
Reference in a new issue