mirror of
https://github.com/overte-org/overte.git
synced 2025-07-24 01:23:55 +02:00
try harder to have line rezzed when it's needed. don't ignore entities that are too close when doing line intersection
This commit is contained in:
parent
7b5d6c20e9
commit
e650e40388
1 changed files with 25 additions and 18 deletions
|
@ -91,6 +91,18 @@ function controller(side, triggerAction, pullAction, hand) {
|
||||||
this.prevTriggerValue = 0;
|
this.prevTriggerValue = 0;
|
||||||
this.palm = 2 * side;
|
this.palm = 2 * side;
|
||||||
this.tip = 2 * side + 1;
|
this.tip = 2 * side + 1;
|
||||||
|
this.pointer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
controller.prototype.updateLine = function() {
|
||||||
|
if (this.pointer != null) {
|
||||||
|
if (Entities.getEntityProperties(this.pointer).id != this.poitner) {
|
||||||
|
this.pointer == null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.pointer == null) {
|
||||||
this.lineCreationTime = Date.now();
|
this.lineCreationTime = Date.now();
|
||||||
this.pointer = Entities.addEntity({
|
this.pointer = Entities.addEntity({
|
||||||
type: "Line",
|
type: "Line",
|
||||||
|
@ -101,14 +113,12 @@ function controller(side, triggerAction, pullAction, hand) {
|
||||||
y: 1000,
|
y: 1000,
|
||||||
z: 1000
|
z: 1000
|
||||||
},
|
},
|
||||||
visible: false,
|
visible: true,
|
||||||
lifetime: LIFETIME
|
lifetime: LIFETIME
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
controller.prototype.updateLine = function() {
|
|
||||||
var handPosition = this.getHandPosition();
|
var handPosition = this.getHandPosition();
|
||||||
var direction = Quat.getUp(this.getHandRotation());
|
var direction = Quat.getUp(this.getHandRotation());
|
||||||
|
|
||||||
|
@ -129,10 +139,7 @@ controller.prototype.updateLine = function() {
|
||||||
lifetime: (Date.now() - startTime) / 1000.0 + LIFETIME
|
lifetime: (Date.now() - startTime) / 1000.0 + LIFETIME
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (this.checkForIntersections(handPosition, direction)) {
|
||||||
//move origin a bit away from hand so nothing gets in way
|
|
||||||
var origin = Vec3.sum(handPosition, direction);
|
|
||||||
if (this.checkForIntersections(origin, direction)) {
|
|
||||||
Entities.editEntity(this.pointer, {
|
Entities.editEntity(this.pointer, {
|
||||||
color: INTERSECT_COLOR,
|
color: INTERSECT_COLOR,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue