mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:27:04 +02:00
fix search ray getting left on. started adding stylus models
This commit is contained in:
parent
e434defc7f
commit
756d96c368
3 changed files with 40 additions and 7 deletions
BIN
interface/resources/meshes/tablet-stylus-fat.fbx
Normal file
BIN
interface/resources/meshes/tablet-stylus-fat.fbx
Normal file
Binary file not shown.
BIN
interface/resources/meshes/tablet-stylus-skinny.fbx
Normal file
BIN
interface/resources/meshes/tablet-stylus-skinny.fbx
Normal file
Binary file not shown.
|
@ -740,7 +740,7 @@ function MyController(hand) {
|
||||||
// (1) avatar-A does a parenting grab on something, and then (2) avatar-B takes it, and (3) avatar-A
|
// (1) avatar-A does a parenting grab on something, and then (2) avatar-B takes it, and (3) avatar-A
|
||||||
// releases it and then (4) avatar-B releases it, then avatar-B will set the parent back to
|
// releases it and then (4) avatar-B releases it, then avatar-B will set the parent back to
|
||||||
// avatar-A's hand. Avatar-A is no longer grabbing it, so it will end up triggering avatar-A's
|
// avatar-A's hand. Avatar-A is no longer grabbing it, so it will end up triggering avatar-A's
|
||||||
// checkForStrayChildren which will put it back to wherever it was when avatar-A initially grabbed it.
|
// checkForUnexpectedChildren which will put it back to wherever it was when avatar-A initially grabbed it.
|
||||||
// this will work most of the time, unless avatar-A crashes or logs out while avatar-B is grabbing the
|
// this will work most of the time, unless avatar-A crashes or logs out while avatar-B is grabbing the
|
||||||
// entity. This can also happen when a single avatar passes something from hand to hand.
|
// entity. This can also happen when a single avatar passes something from hand to hand.
|
||||||
this.previousParentID = {};
|
this.previousParentID = {};
|
||||||
|
@ -945,7 +945,35 @@ function MyController(hand) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.showStylus = function() {
|
this.showModelStylus = function() {
|
||||||
|
if (this.stylus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!MyAvatar.sessionUUID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var stylusProperties = {
|
||||||
|
// url: Script.resourcesPath() + "meshes/tablet-stylus-skinny.fbx",
|
||||||
|
url: Script.resourcesPath() + "meshes/tablet-stylus-fat.fbx",
|
||||||
|
localPosition: Vec3.sum({ x: 0.0, y: WEB_TOUCH_DISTANCE / 2.0, z: 0.0 },
|
||||||
|
getGrabPointSphereOffset(this.handToController())),
|
||||||
|
localRotation: { x: 0, y: 0, z: 0, w: 1 },
|
||||||
|
// dimensions: { x: 0.01, y: WEB_TOUCH_DISTANCE - WEB_TOUCH_SPHERE_RADIUS, z: 0.01 },
|
||||||
|
solid: true,
|
||||||
|
visible: true,
|
||||||
|
ignoreRayIntersection: true,
|
||||||
|
drawInFront: false,
|
||||||
|
parentID: MyAvatar.sessionUUID,
|
||||||
|
parentJointIndex: MyAvatar.getJointIndex(this.hand === RIGHT_HAND ?
|
||||||
|
"_CONTROLLER_RIGHTHAND" :
|
||||||
|
"_CONTROLLER_LEFTHAND")
|
||||||
|
};
|
||||||
|
this.stylus = Overlays.addOverlay("model", stylusProperties);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.showPrimStylus = function() {
|
||||||
if (this.stylus) {
|
if (this.stylus) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -989,14 +1017,17 @@ function MyController(hand) {
|
||||||
this.stylus = Overlays.addOverlay("cube", stylusProperties);
|
this.stylus = Overlays.addOverlay("cube", stylusProperties);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.showStylus = function() {
|
||||||
|
return this.showPrimStylus();
|
||||||
|
// return this.showModelStylus();
|
||||||
|
};
|
||||||
|
|
||||||
this.hideStylus = function() {
|
this.hideStylus = function() {
|
||||||
if (!this.stylus) {
|
if (!this.stylus) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Overlays.deleteOverlay(this.stylus);
|
Overlays.deleteOverlay(this.stylus);
|
||||||
this.stylus = null;
|
this.stylus = null;
|
||||||
Overlays.deleteOverlay(this.stylusTip);
|
|
||||||
this.stylusTip = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.overlayLineOn = function(closePoint, farPoint, color) {
|
this.overlayLineOn = function(closePoint, farPoint, color) {
|
||||||
|
@ -1166,7 +1197,7 @@ function MyController(hand) {
|
||||||
|
|
||||||
this.off = function(deltaTime, timestamp) {
|
this.off = function(deltaTime, timestamp) {
|
||||||
|
|
||||||
this.checkForStrayChildren();
|
this.checkForUnexpectedChildren();
|
||||||
|
|
||||||
if (this.triggerSmoothedReleased() && this.secondaryReleased()) {
|
if (this.triggerSmoothedReleased() && this.secondaryReleased()) {
|
||||||
this.waitForTriggerRelease = false;
|
this.waitForTriggerRelease = false;
|
||||||
|
@ -1548,9 +1579,11 @@ function MyController(hand) {
|
||||||
this.isInitialGrab = false;
|
this.isInitialGrab = false;
|
||||||
this.preparingHoldRelease = false;
|
this.preparingHoldRelease = false;
|
||||||
|
|
||||||
this.checkForStrayChildren();
|
this.checkForUnexpectedChildren();
|
||||||
|
|
||||||
if ((this.triggerSmoothedReleased() && this.secondaryReleased())) {
|
if ((this.triggerSmoothedReleased() && this.secondaryReleased())) {
|
||||||
|
this.grabbedEntity = null;
|
||||||
|
this.release();
|
||||||
this.setState(STATE_OFF, "trigger released");
|
this.setState(STATE_OFF, "trigger released");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2941,7 +2974,7 @@ function MyController(hand) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.checkForStrayChildren = function() {
|
this.checkForUnexpectedChildren = function() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
// sometimes things can get parented to a hand and this script is unaware. Search for such entities and
|
// sometimes things can get parented to a hand and this script is unaware. Search for such entities and
|
||||||
// unhook them.
|
// unhook them.
|
||||||
|
|
Loading…
Reference in a new issue