mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
make it so that only you can see your beams until youre grabbing something
This commit is contained in:
parent
1ba6bfa2e0
commit
25422084b9
1 changed files with 43 additions and 24 deletions
|
@ -200,6 +200,7 @@ function entityIsGrabbedByOther(entityID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function MyController(hand) {
|
function MyController(hand) {
|
||||||
this.hand = hand;
|
this.hand = hand;
|
||||||
if (this.hand === RIGHT_HAND) {
|
if (this.hand === RIGHT_HAND) {
|
||||||
|
@ -223,6 +224,8 @@ function MyController(hand) {
|
||||||
this.rawTriggerValue = 0;
|
this.rawTriggerValue = 0;
|
||||||
this.rawBumperValue = 0;
|
this.rawBumperValue = 0;
|
||||||
|
|
||||||
|
this.overlayLine = null;
|
||||||
|
|
||||||
this.offsetPosition = {
|
this.offsetPosition = {
|
||||||
x: 0.0,
|
x: 0.0,
|
||||||
y: 0.0,
|
y: 0.0,
|
||||||
|
@ -318,32 +321,35 @@ function MyController(hand) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.overlayLineOn = function(color) {
|
this.overlayLineOn = function(closePoint, farPoint, color) {
|
||||||
|
if (this.overlayLine === null) {
|
||||||
|
print('creating handline')
|
||||||
|
|
||||||
var handPosition = this.getHandPosition();
|
var lineProperties = {
|
||||||
var distantPickRay = {
|
lineWidth: 5,
|
||||||
origin: handPosition,
|
start: closePoint,
|
||||||
direction: Quat.getUp(this.getHandRotation()),
|
end: farPoint,
|
||||||
length: PICK_MAX_DISTANCE
|
color: color,
|
||||||
};
|
ignoreRayIntersection: true, // always ignore this
|
||||||
|
visible: true,
|
||||||
|
alpha: 1
|
||||||
|
};
|
||||||
|
|
||||||
var end = Vec3.Sum(handPosition, Vec3.multiply(distantPickRay.direction, NEAR_PICK_MAX_DISTANCE));
|
this.overlayLine = Overlays.addOverlay("line3d", lineProperties);
|
||||||
|
|
||||||
var lineProperties = {
|
} else {
|
||||||
lineWidth: 5,
|
print('editing handline' + this.overlayLine)
|
||||||
//get palm position
|
var success = Overlays.editOverlay(this.overlayLine, {
|
||||||
start: distantPickRay.origin,
|
lineWidth: 5,
|
||||||
end: end,
|
start: closePoint,
|
||||||
color: color || {
|
end: farPoint,
|
||||||
red: 255,
|
color: color,
|
||||||
green: 0,
|
visible: true,
|
||||||
blue: 255
|
ignoreRayIntersection: true, // always ignore this
|
||||||
},
|
alpha: 1
|
||||||
ignoreRayIntersection: true, // always ignore this
|
});
|
||||||
visible: true,
|
}
|
||||||
};
|
|
||||||
|
|
||||||
this.pointerOverlay = Overlays.addOverlay("line3d", lineProperties);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lineOn = function(closePoint, farPoint, color) {
|
this.lineOn = function(closePoint, farPoint, color) {
|
||||||
|
@ -384,6 +390,13 @@ function MyController(hand) {
|
||||||
this.pointer = null;
|
this.pointer = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.overlayLineOff = function() {
|
||||||
|
if (this.overlayLine !== null) {
|
||||||
|
Overlays.deleteOverlay(this.overlayLine);
|
||||||
|
}
|
||||||
|
this.overlayLine = null;
|
||||||
|
};
|
||||||
|
|
||||||
this.triggerPress = function(value) {
|
this.triggerPress = function(value) {
|
||||||
_this.rawTriggerValue = value;
|
_this.rawTriggerValue = value;
|
||||||
};
|
};
|
||||||
|
@ -626,7 +639,8 @@ function MyController(hand) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lineOn(distantPickRay.origin, Vec3.multiply(distantPickRay.direction, LINE_LENGTH), NO_INTERSECT_COLOR);
|
//this.lineOn(distantPickRay.origin, Vec3.multiply(distantPickRay.direction, LINE_LENGTH), NO_INTERSECT_COLOR);
|
||||||
|
this.overlayLineOn(distantPickRay.origin, Vec3.sum(distantPickRay.origin, Vec3.multiply(distantPickRay.direction, LINE_LENGTH)), NO_INTERSECT_COLOR);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.distanceHolding = function() {
|
this.distanceHolding = function() {
|
||||||
|
@ -672,6 +686,9 @@ function MyController(hand) {
|
||||||
this.currentAvatarPosition = MyAvatar.position;
|
this.currentAvatarPosition = MyAvatar.position;
|
||||||
this.currentAvatarOrientation = MyAvatar.orientation;
|
this.currentAvatarOrientation = MyAvatar.orientation;
|
||||||
|
|
||||||
|
this.overlayLineOff();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.continueDistanceHolding = function() {
|
this.continueDistanceHolding = function() {
|
||||||
|
@ -779,6 +796,7 @@ function MyController(hand) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lineOff();
|
this.lineOff();
|
||||||
|
this.overlayLineOff();
|
||||||
|
|
||||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, GRABBABLE_PROPERTIES);
|
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, GRABBABLE_PROPERTIES);
|
||||||
this.activateEntity(this.grabbedEntity, grabbedProperties);
|
this.activateEntity(this.grabbedEntity, grabbedProperties);
|
||||||
|
@ -918,6 +936,7 @@ function MyController(hand) {
|
||||||
|
|
||||||
this.pullTowardEquipPosition = function() {
|
this.pullTowardEquipPosition = function() {
|
||||||
this.lineOff();
|
this.lineOff();
|
||||||
|
this.overlayLineOff();
|
||||||
|
|
||||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, GRABBABLE_PROPERTIES);
|
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, GRABBABLE_PROPERTIES);
|
||||||
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
||||||
|
@ -1121,7 +1140,7 @@ function MyController(hand) {
|
||||||
this.release = function() {
|
this.release = function() {
|
||||||
|
|
||||||
this.lineOff();
|
this.lineOff();
|
||||||
|
this.overlayLineOff();
|
||||||
if (this.grabbedEntity !== null) {
|
if (this.grabbedEntity !== null) {
|
||||||
if (this.actionID !== null) {
|
if (this.actionID !== null) {
|
||||||
Entities.deleteAction(this.grabbedEntity, this.actionID);
|
Entities.deleteAction(this.grabbedEntity, this.actionID);
|
||||||
|
|
Loading…
Reference in a new issue