mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 22:44:13 +02:00
switch to model stylus
This commit is contained in:
parent
439d6f0fa3
commit
1f92b57bf2
1 changed files with 17 additions and 12 deletions
|
@ -65,7 +65,8 @@ var WEB_STYLUS_COLOR = { red: 0, green: 240, blue: 0 };
|
||||||
var WEB_STYLUS_TIP_COLOR = { red: 0, green: 0, blue: 240 };
|
var WEB_STYLUS_TIP_COLOR = { red: 0, green: 0, blue: 240 };
|
||||||
var WEB_STYLUS_ALPHA = 1.0;
|
var WEB_STYLUS_ALPHA = 1.0;
|
||||||
var WEB_DISPLAY_STYLUS_DISTANCE = 0.5;
|
var WEB_DISPLAY_STYLUS_DISTANCE = 0.5;
|
||||||
var WEB_TOUCH_DISTANCE = 0.2;
|
var WEB_STYLUS_LENGTH = 0.2;
|
||||||
|
var WEB_TOUCH_Y_OFFSET = 0.05; // how far forward (or back with a negative number) to slide stylus in hand
|
||||||
|
|
||||||
//
|
//
|
||||||
// distant manipulation
|
// distant manipulation
|
||||||
|
@ -958,11 +959,13 @@ function MyController(hand) {
|
||||||
var stylusProperties = {
|
var stylusProperties = {
|
||||||
// url: Script.resourcesPath() + "meshes/tablet-stylus-skinny.fbx",
|
// url: Script.resourcesPath() + "meshes/tablet-stylus-skinny.fbx",
|
||||||
url: Script.resourcesPath() + "meshes/tablet-stylus-fat.fbx",
|
url: Script.resourcesPath() + "meshes/tablet-stylus-fat.fbx",
|
||||||
localPosition: Vec3.sum({ x: 0.0, y: WEB_TOUCH_DISTANCE / 2.0, z: 0.0 },
|
localPosition: Vec3.sum({ x: 0.0,
|
||||||
|
y: WEB_TOUCH_Y_OFFSET,
|
||||||
|
z: 0.0 },
|
||||||
getGrabPointSphereOffset(this.handToController())),
|
getGrabPointSphereOffset(this.handToController())),
|
||||||
// localRotation: { x: 0, y: 0, z: 0, w: 1 },
|
// localRotation: { x: 0, y: 0, z: 0, w: 1 },
|
||||||
localRotation: Quat.fromVec3Degrees({ x: -90, y: 0, z: 0 }),
|
localRotation: Quat.fromVec3Degrees({ x: -90, y: 0, z: 0 }),
|
||||||
// dimensions: { x: 0.01, y: WEB_TOUCH_DISTANCE - WEB_TOUCH_SPHERE_RADIUS, z: 0.01 },
|
dimensions: { x: 0.01, y: 0.01, z: WEB_STYLUS_LENGTH },
|
||||||
solid: true,
|
solid: true,
|
||||||
visible: true,
|
visible: true,
|
||||||
ignoreRayIntersection: true,
|
ignoreRayIntersection: true,
|
||||||
|
@ -984,7 +987,7 @@ function MyController(hand) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var stylusTipProperties = {
|
var stylusTipProperties = {
|
||||||
localPosition: Vec3.sum({ x: 0, y: WEB_TOUCH_DISTANCE - (WEB_TOUCH_SPHERE_RADIUS / 2.0), z: 0 },
|
localPosition: Vec3.sum({ x: 0, y: WEB_STYLUS_LENGTH - (WEB_TOUCH_SPHERE_RADIUS / 2.0), z: 0 },
|
||||||
getGrabPointSphereOffset(this.handToController())),
|
getGrabPointSphereOffset(this.handToController())),
|
||||||
localRotation: { x: 0, y: 0, z: 0, w: 1 },
|
localRotation: { x: 0, y: 0, z: 0, w: 1 },
|
||||||
dimensions: WEB_TOUCH_SPHERE_RADIUS,
|
dimensions: WEB_TOUCH_SPHERE_RADIUS,
|
||||||
|
@ -1002,10 +1005,10 @@ function MyController(hand) {
|
||||||
this.stylusTip = Overlays.addOverlay("sphere", stylusTipProperties);
|
this.stylusTip = Overlays.addOverlay("sphere", stylusTipProperties);
|
||||||
|
|
||||||
var stylusProperties = {
|
var stylusProperties = {
|
||||||
localPosition: Vec3.sum({ x: 0.0, y: WEB_TOUCH_DISTANCE / 2.0, z: 0.0 },
|
localPosition: Vec3.sum({ x: 0.0, y: WEB_STYLUS_LENGTH / 2.0, z: 0.0 },
|
||||||
getGrabPointSphereOffset(this.handToController())),
|
getGrabPointSphereOffset(this.handToController())),
|
||||||
localRotation: { x: 0, y: 0, z: 0, w: 1 },
|
localRotation: { x: 0, y: 0, z: 0, w: 1 },
|
||||||
dimensions: { x: 0.01, y: WEB_TOUCH_DISTANCE - WEB_TOUCH_SPHERE_RADIUS, z: 0.01 },
|
dimensions: { x: 0.01, y: WEB_STYLUS_LENGTH + WEB_TOUCH_SPHERE_RADIUS, z: 0.01 },
|
||||||
color: WEB_STYLUS_COLOR,
|
color: WEB_STYLUS_COLOR,
|
||||||
alpha: WEB_STYLUS_ALPHA,
|
alpha: WEB_STYLUS_ALPHA,
|
||||||
solid: true,
|
solid: true,
|
||||||
|
@ -1021,8 +1024,8 @@ function MyController(hand) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.showStylus = function() {
|
this.showStylus = function() {
|
||||||
return this.showPrimStylus();
|
// return this.showPrimStylus();
|
||||||
// return this.showModelStylus();
|
return this.showModelStylus();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.hideStylus = function() {
|
this.hideStylus = function() {
|
||||||
|
@ -1263,7 +1266,7 @@ function MyController(hand) {
|
||||||
if (nearWeb) {
|
if (nearWeb) {
|
||||||
this.showStylus();
|
this.showStylus();
|
||||||
var rayPickInfo = this.calcRayPickInfo(this.hand);
|
var rayPickInfo = this.calcRayPickInfo(this.hand);
|
||||||
if (rayPickInfo.distance < WEB_TOUCH_DISTANCE) {
|
if (rayPickInfo.distance < WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET) {
|
||||||
if (this.handleStylusOnWebEntity(rayPickInfo)) {
|
if (this.handleStylusOnWebEntity(rayPickInfo)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1662,7 +1665,7 @@ function MyController(hand) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rayPickInfo.distance >= WEB_TOUCH_DISTANCE) {
|
if (rayPickInfo.distance >= WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET) {
|
||||||
if (this.handleLaserOnWebEntity(rayPickInfo)) {
|
if (this.handleLaserOnWebEntity(rayPickInfo)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2761,7 +2764,8 @@ function MyController(hand) {
|
||||||
getControllerWorldLocation(this.handToController(), true));
|
getControllerWorldLocation(this.handToController(), true));
|
||||||
if (intersectInfo) {
|
if (intersectInfo) {
|
||||||
|
|
||||||
if (this.state == STATE_ENTITY_STYLUS_TOUCHING && intersectInfo.distance > WEB_TOUCH_DISTANCE) {
|
if (this.state == STATE_ENTITY_STYLUS_TOUCHING &&
|
||||||
|
intersectInfo.distance > WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET) {
|
||||||
this.grabbedEntity = null;
|
this.grabbedEntity = null;
|
||||||
this.setState(STATE_OFF, "pulled away from web entity");
|
this.setState(STATE_OFF, "pulled away from web entity");
|
||||||
return;
|
return;
|
||||||
|
@ -2879,7 +2883,8 @@ function MyController(hand) {
|
||||||
handLaserIntersectOverlay(this.grabbedOverlay, getControllerWorldLocation(this.handToController(), true));
|
handLaserIntersectOverlay(this.grabbedOverlay, getControllerWorldLocation(this.handToController(), true));
|
||||||
if (intersectInfo) {
|
if (intersectInfo) {
|
||||||
|
|
||||||
if (this.state == STATE_OVERLAY_STYLUS_TOUCHING && intersectInfo.distance > WEB_TOUCH_DISTANCE) {
|
if (this.state == STATE_OVERLAY_STYLUS_TOUCHING &&
|
||||||
|
intersectInfo.distance > WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET) {
|
||||||
this.grabbedEntity = null;
|
this.grabbedEntity = null;
|
||||||
this.setState(STATE_OFF, "pulled away from overlay");
|
this.setState(STATE_OFF, "pulled away from overlay");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue