mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 06:13:09 +02:00
added lightball back
This commit is contained in:
parent
035ca25b48
commit
3e6ae7c571
4 changed files with 88 additions and 16 deletions
|
@ -35,9 +35,9 @@ ArcBall = function(spawnPosition) {
|
|||
z: 0
|
||||
}),
|
||||
dimensions: {
|
||||
x: .1,
|
||||
y: .1,
|
||||
z: .1
|
||||
x: .2,
|
||||
y: .2,
|
||||
z: .2
|
||||
},
|
||||
color: {
|
||||
red: 15,
|
||||
|
@ -102,7 +102,7 @@ ArcBall = function(spawnPosition) {
|
|||
},
|
||||
maxParticles: 100000,
|
||||
lifespan: 2,
|
||||
emitRate: 10000,
|
||||
emitRate: 1000,
|
||||
emitSpeed: .1,
|
||||
lifetime: -1,
|
||||
speedSpread: 0.0,
|
||||
|
|
|
@ -25,16 +25,86 @@
|
|||
entities.forEach(function(entity) {
|
||||
var props = Entities.getEntityProperties(entity, ["position", "name"]);
|
||||
if (props.name === "Arc Ball" && JSON.stringify(_this.entityID) !== JSON.stringify(entity)) {
|
||||
print ("WE FOUND ANOTHER ARC BALL");
|
||||
_this.createBeam(position, props.position);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
continueNearGrab: function() {
|
||||
createBeam: function(startPosition, endPosition) {
|
||||
print("CREATE BEAM")
|
||||
// Creates particle arc from start position to end position
|
||||
var sourceToTargetVec = Vec3.subtract(endPosition, startPosition);
|
||||
var emitOrientation = Quat.rotationBetween(Vec3.UNIT_Z, sourceToTargetVec);
|
||||
|
||||
testBox = Entities.addEntity({
|
||||
type: "Box",
|
||||
dimensions: {x: .1, y: .1, z: 1},
|
||||
color: {red: 200, green: 10, blue: 10},
|
||||
position: startPosition,
|
||||
rotation: emitOrientation
|
||||
});
|
||||
var color = {
|
||||
red: 200,
|
||||
green: 10,
|
||||
blue: 10
|
||||
};
|
||||
var props = {
|
||||
type: "ParticleEffect",
|
||||
name: "Particle Arc",
|
||||
parentID: this.entityID,
|
||||
isEmitting: true,
|
||||
colorStart: color,
|
||||
color: {
|
||||
red: 200,
|
||||
green: 200,
|
||||
blue: 255
|
||||
},
|
||||
colorFinish: color,
|
||||
maxParticles: 100000,
|
||||
lifespan: 2,
|
||||
emitRate: 1000,
|
||||
emitOrientation: emitOrientation,
|
||||
emitSpeed: .4,
|
||||
speedSpread: 0.0,
|
||||
emitDimensions: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0
|
||||
},
|
||||
polarStart: 0,
|
||||
polarFinish: .0,
|
||||
azimuthStart: .1,
|
||||
azimuthFinish: .01,
|
||||
emitAcceleration: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0
|
||||
},
|
||||
accelerationSpread: {
|
||||
x: .00,
|
||||
y: .00,
|
||||
z: .00
|
||||
},
|
||||
radiusStart: 0.03,
|
||||
adiusFinish: 0.025,
|
||||
alpha: 0.7,
|
||||
alphaSpread: .1,
|
||||
alphaStart: 0.5,
|
||||
alphaFinish: 0.5,
|
||||
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
|
||||
emitterShouldTrail: false
|
||||
}
|
||||
this.particleArc = Entities.addEntity(props);
|
||||
},
|
||||
|
||||
releaseGrab: function() {
|
||||
continueNearGrab: function() {},
|
||||
|
||||
releaseGrab: function() {},
|
||||
|
||||
unload: function() {
|
||||
Entities.deleteEntity(this.particleArc);
|
||||
Entities.deleteEntity(testBox);
|
||||
},
|
||||
|
||||
preload: function(entityID) {
|
||||
|
@ -42,4 +112,4 @@
|
|||
},
|
||||
};
|
||||
return new ArcBall();
|
||||
});
|
||||
});
|
|
@ -25,10 +25,10 @@ var basePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1, Quat.getFront(Ca
|
|||
basePosition.y = MyAvatar.position.y + 1;
|
||||
|
||||
// RAVE ITEMS
|
||||
//var lightBall = new LightBall(basePosition);
|
||||
var lightBall = new LightBall(basePosition);
|
||||
|
||||
var arcBall = new ArcBall(basePosition);
|
||||
var arcBall2 = new ArcBall(Vec3.sum(basePosition, {x: -1, y: 0, z: 0}));
|
||||
// var arcBall = new ArcBall(basePosition);
|
||||
// var arcBall2 = new ArcBall(Vec3.sum(basePosition, {x: -1, y: 0, z: 0}));
|
||||
var raveStick = new RaveStick(Vec3.sum(basePosition, {x: 1, y: 0.5, z: 1}));
|
||||
var lightSaber = new LightSaber(Vec3.sum(basePosition, {x: 3, y: 0.5, z: 1}));
|
||||
|
||||
|
@ -79,10 +79,11 @@ var lightZone = Entities.addEntity({
|
|||
function cleanup() {
|
||||
|
||||
Entities.deleteEntity(raveRoom);
|
||||
Entities.deleteEntity(lightZone)
|
||||
Entities.deleteEntity(lightZone);
|
||||
Entities.deleteEntity(floor);
|
||||
arcBall.cleanup();
|
||||
arcBall2.cleanup();
|
||||
lightBall.cleanup();
|
||||
// arcBall.cleanup();
|
||||
// arcBall2.cleanup();
|
||||
raveStick.cleanup();
|
||||
lightSaber.cleanup();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,8 @@
|
|||
this.props = Entities.getEntityProperties(this.entityID, ["position", "rotation"]);
|
||||
var forwardVec = Quat.getFront(Quat.multiply(this.props.rotation, Quat.fromPitchYawRollDegrees(-90, 0, 0)));
|
||||
// forwardVec = Vec3.normalize(forwardVec);
|
||||
var forwardQuat = orientationOf(forwardVec);
|
||||
// var forwardQuat = orientationOf(forwardVec);
|
||||
var forwardQuat = Quat.rotationBetween(Vec3.UNIT_Z, forwardVec);
|
||||
var position = Vec3.sum(this.props.position, Vec3.multiply(Quat.getFront(this.props.rotation), 0.1));
|
||||
position.z += 0.1;
|
||||
position.x += -0.035;
|
||||
|
|
Loading…
Reference in a new issue