mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 04:08:13 +02:00
accounted for the forward offset
This commit is contained in:
parent
6e34971889
commit
ae960b840a
1 changed files with 6 additions and 6 deletions
|
@ -41,6 +41,7 @@
|
||||||
function laser(hand) {
|
function laser(hand) {
|
||||||
|
|
||||||
var PICK_MAX_DISTANCE = 500;
|
var PICK_MAX_DISTANCE = 500;
|
||||||
|
var FORWARD_OFFSET = 0.05;
|
||||||
|
|
||||||
var isNewEntityNeeded = (laserEntities[hand].beam === null);
|
var isNewEntityNeeded = (laserEntities[hand].beam === null);
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@
|
||||||
color: {red: 0, green: 255, blue: 0},
|
color: {red: 0, green: 255, blue: 0},
|
||||||
parentID: MyAvatar.sessionUUID,
|
parentID: MyAvatar.sessionUUID,
|
||||||
parentJointIndex: MyAvatar.getJointIndex(jointName),
|
parentJointIndex: MyAvatar.getJointIndex(jointName),
|
||||||
localPosition: {x: 0, y: .05, z: 0},
|
localPosition: {x: 0, y: FORWARD_OFFSET, z: 0},
|
||||||
localRotation: Quat.normalize({}),
|
localRotation: Quat.normalize({}),
|
||||||
dimensions: Vec3.multiply(PICK_MAX_DISTANCE * 2, Vec3.ONE),
|
dimensions: Vec3.multiply(PICK_MAX_DISTANCE * 2, Vec3.ONE),
|
||||||
linePoints: [Vec3.ZERO, {x: 0, y: dist, z: 0}]
|
linePoints: [Vec3.ZERO, {x: 0, y: dist, z: 0}]
|
||||||
|
@ -115,26 +116,25 @@
|
||||||
Entities.editEntity(laserEntities[hand].beam, {
|
Entities.editEntity(laserEntities[hand].beam, {
|
||||||
parentID: MyAvatar.sessionUUID,
|
parentID: MyAvatar.sessionUUID,
|
||||||
parentJointIndex: MyAvatar.getJointIndex(jointName),
|
parentJointIndex: MyAvatar.getJointIndex(jointName),
|
||||||
localPosition: {x: 0, y: .05, z: 0},
|
localPosition: {x: 0, y: FORWARD_OFFSET, z: 0},
|
||||||
localRotation: Quat.normalize({}),
|
localRotation: Quat.normalize({}),
|
||||||
dimensions: Vec3.multiply(PICK_MAX_DISTANCE * 2, Vec3.ONE),
|
dimensions: Vec3.multiply(PICK_MAX_DISTANCE * 2, Vec3.ONE),
|
||||||
linePoints: [Vec3.ZERO, {x: 0, y: dist, z: 0}]
|
linePoints: [Vec3.ZERO, {x: 0, y: dist - FORWARD_OFFSET, z: 0}]
|
||||||
});
|
});
|
||||||
|
|
||||||
Entities.editEntity(laserEntities[hand].sphere, {
|
Entities.editEntity(laserEntities[hand].sphere, {
|
||||||
dimensions: {x: sphereSize, y: sphereSize, z: sphereSize},
|
dimensions: {x: sphereSize, y: sphereSize, z: sphereSize},
|
||||||
position: intersection,
|
position: intersection,
|
||||||
visible: true
|
visible: true
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Entities.editEntity(laserEntities[hand].beam, {
|
Entities.editEntity(laserEntities[hand].beam, {
|
||||||
parentID: MyAvatar.sessionUUID,
|
parentID: MyAvatar.sessionUUID,
|
||||||
parentJointIndex: MyAvatar.getJointIndex(jointName),
|
parentJointIndex: MyAvatar.getJointIndex(jointName),
|
||||||
localPosition: {x: 0, y: .05, z: 0},
|
localPosition: {x: 0, y: FORWARD_OFFSET, z: 0},
|
||||||
localRotation: Quat.normalize({}),
|
localRotation: Quat.normalize({}),
|
||||||
dimensions: Vec3.multiply(PICK_MAX_DISTANCE * 2, Vec3.ONE),
|
dimensions: Vec3.multiply(PICK_MAX_DISTANCE * 2, Vec3.ONE),
|
||||||
linePoints: [Vec3.ZERO, {x: 0, y: dist, z: 0}]
|
linePoints: [Vec3.ZERO, {x: 0, y: dist - FORWARD_OFFSET, z: 0}]
|
||||||
});
|
});
|
||||||
Entities.editEntity(laserEntities[hand].sphere, {
|
Entities.editEntity(laserEntities[hand].sphere, {
|
||||||
visible: false
|
visible: false
|
||||||
|
|
Loading…
Reference in a new issue