mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 05:52:31 +02:00
Merge pull request #6464 from ericrius1/whiteboardFix
updated whiteboard to use new controller approach
This commit is contained in:
commit
1d8e2edafb
1 changed files with 9 additions and 6 deletions
|
@ -29,6 +29,11 @@
|
|||
var MIN_STROKE_WIDTH = 0.0005;
|
||||
var MAX_STROKE_WIDTH = 0.03;
|
||||
|
||||
var TRIGGER_CONTROLS = [
|
||||
Controller.Standard.LT,
|
||||
Controller.Standard.RT,
|
||||
];
|
||||
|
||||
Whiteboard = function() {
|
||||
_this = this;
|
||||
};
|
||||
|
@ -51,11 +56,9 @@
|
|||
if (this.hand === RIGHT_HAND) {
|
||||
this.getHandPosition = MyAvatar.getRightPalmPosition;
|
||||
this.getHandRotation = MyAvatar.getRightPalmRotation;
|
||||
this.triggerAction = Controller.findAction("RIGHT_HAND_CLICK");
|
||||
} else if (this.hand === LEFT_HAND) {
|
||||
this.getHandPosition = MyAvatar.getLeftPalmPosition;
|
||||
this.getHandRotation = MyAvatar.getLeftPalmRotation;
|
||||
this.triggerAction = Controller.findAction("LEFT_HAND_CLICK");
|
||||
}
|
||||
Overlays.editOverlay(this.laserPointer, {
|
||||
visible: true
|
||||
|
@ -76,7 +79,7 @@
|
|||
if (this.intersection.intersects) {
|
||||
var distance = Vec3.distance(handPosition, this.intersection.intersection);
|
||||
if (distance < MAX_DISTANCE) {
|
||||
this.triggerValue = Controller.getActionValue(this.triggerAction);
|
||||
this.triggerValue = Controller.getValue(TRIGGER_CONTROLS[this.hand]);
|
||||
this.currentStrokeWidth = map(this.triggerValue, 0, 1, MIN_STROKE_WIDTH, MAX_STROKE_WIDTH);
|
||||
var displayPoint = this.intersection.intersection;
|
||||
displayPoint = Vec3.sum(displayPoint, Vec3.multiply(this.normal, 0.01));
|
||||
|
|
Loading…
Reference in a new issue