mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:58:03 +02:00
far grabbing arc balls
This commit is contained in:
parent
cabc47e7a9
commit
876d8ab6b2
3 changed files with 12 additions and 17 deletions
|
@ -15,7 +15,7 @@
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("../../libraries/utils.js");
|
||||||
|
|
||||||
|
|
||||||
var scriptURL = Script.resolvePath("arcBallEntityScript.js");
|
var scriptURL = Script.resolvePath("arcBallEntityScript.js?v1" + Math.random());
|
||||||
ArcBall = function(spawnPosition) {
|
ArcBall = function(spawnPosition) {
|
||||||
|
|
||||||
var colorPalette = [{
|
var colorPalette = [{
|
||||||
|
@ -50,11 +50,11 @@ ArcBall = function(spawnPosition) {
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
spatialKey: {
|
spatialKey: {
|
||||||
relativePosition: {
|
// relativePosition: {
|
||||||
x: 0,
|
// x: 0,
|
||||||
y: 0.0,
|
// y: -0.5,
|
||||||
z: -0.5
|
// z: 0.0
|
||||||
},
|
// },
|
||||||
},
|
},
|
||||||
// invertSolidWhileHeld: true
|
// invertSolidWhileHeld: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,11 @@
|
||||||
|
|
||||||
ArcBall.prototype = {
|
ArcBall.prototype = {
|
||||||
isGrabbed: false,
|
isGrabbed: false,
|
||||||
startDistanceGrab: function() {
|
startDistantGrab: function() {
|
||||||
this.searchForNearbyArcBalls();
|
this.searchForNearbyArcBalls();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
startFarGrab: function() {
|
startNearGrab: function() {
|
||||||
this.searchForNearbyArcBalls();
|
this.searchForNearbyArcBalls();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -58,7 +57,6 @@
|
||||||
var emitOrientation = Quat.rotationBetween(Vec3.UNIT_Z, sourceToTargetVec);
|
var emitOrientation = Quat.rotationBetween(Vec3.UNIT_Z, sourceToTargetVec);
|
||||||
emitOrientation = Quat.multiply(Quat.inverse(rotation), emitOrientation);
|
emitOrientation = Quat.multiply(Quat.inverse(rotation), emitOrientation);
|
||||||
|
|
||||||
|
|
||||||
var color = this.colorPalette[randInt(0, this.colorPalette.length)];
|
var color = this.colorPalette[randInt(0, this.colorPalette.length)];
|
||||||
var props = {
|
var props = {
|
||||||
type: "ParticleEffect",
|
type: "ParticleEffect",
|
||||||
|
@ -75,10 +73,10 @@
|
||||||
},
|
},
|
||||||
colorFinish: color,
|
colorFinish: color,
|
||||||
maxParticles: 100000,
|
maxParticles: 100000,
|
||||||
lifespan: 2,
|
lifespan: 1,
|
||||||
emitRate: 1000,
|
emitRate: 1000,
|
||||||
emitOrientation: emitOrientation,
|
emitOrientation: emitOrientation,
|
||||||
emitSpeed: .1,
|
emitSpeed: 1,
|
||||||
speedSpread: 0.02,
|
speedSpread: 0.02,
|
||||||
emitDimensions: {
|
emitDimensions: {
|
||||||
x: .01,
|
x: .01,
|
||||||
|
@ -105,7 +103,7 @@
|
||||||
alpha: 0.5,
|
alpha: 0.5,
|
||||||
alphaSpread: .1,
|
alphaSpread: .1,
|
||||||
alphaStart: 0.5,
|
alphaStart: 0.5,
|
||||||
alphaFinish: 0.0,
|
alphaFinish: 0.5,
|
||||||
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
|
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
|
||||||
emitterShouldTrail: true
|
emitterShouldTrail: true
|
||||||
}
|
}
|
||||||
|
@ -117,12 +115,10 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var startPosition = Entities.getEntityProperties(this.entityID, "position").position;
|
var startPosition = Entities.getEntityProperties(this.entityID, "position").position;
|
||||||
|
|
||||||
var targetPosition = Entities.getEntityProperties(this.target, "position").position;
|
var targetPosition = Entities.getEntityProperties(this.target, "position").position;
|
||||||
var rotation = Entities.getEntityProperties(this.entityID, "rotation").rotation;
|
var rotation = Entities.getEntityProperties(this.entityID, "rotation").rotation;
|
||||||
var sourceToTargetVec = Vec3.subtract(targetPosition, startPosition);
|
var sourceToTargetVec = Vec3.subtract(targetPosition, startPosition);
|
||||||
var emitOrientation = Quat.rotationBetween(Vec3.UNIT_Z, sourceToTargetVec);
|
var emitOrientation = Quat.rotationBetween(Vec3.UNIT_Z, sourceToTargetVec);
|
||||||
// emitOrientation = Quat.multiply(emitOrientation,Quat.inverse(rotation));
|
|
||||||
Entities.editEntity(this.particleArc, {
|
Entities.editEntity(this.particleArc, {
|
||||||
emitOrientation: emitOrientation
|
emitOrientation: emitOrientation
|
||||||
});
|
});
|
||||||
|
@ -132,7 +128,7 @@
|
||||||
this.updateBeam();
|
this.updateBeam();
|
||||||
},
|
},
|
||||||
|
|
||||||
continueDistanceGrab: function() {
|
continueDistantGrab: function() {
|
||||||
this.updateBeam();
|
this.updateBeam();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@
|
||||||
|
|
||||||
createBeam: function() {
|
createBeam: function() {
|
||||||
|
|
||||||
|
|
||||||
this.props = Entities.getEntityProperties(this.entityID, ["position", "rotation"]);
|
this.props = Entities.getEntityProperties(this.entityID, ["position", "rotation"]);
|
||||||
var forwardVec = Quat.getFront(Quat.multiply(this.props.rotation, Quat.fromPitchYawRollDegrees(-90, 0, 0)));
|
var forwardVec = Quat.getFront(Quat.multiply(this.props.rotation, Quat.fromPitchYawRollDegrees(-90, 0, 0)));
|
||||||
// forwardVec = Vec3.normalize(forwardVec);
|
// forwardVec = Vec3.normalize(forwardVec);
|
||||||
|
|
Loading…
Reference in a new issue