mirror of
https://github.com/overte-org/overte.git
synced 2025-04-18 07:56:25 +02:00
8315 Stylus appears in wrong place on hand
This commit is contained in:
parent
61a2d80117
commit
ddd25da430
1 changed files with 19 additions and 0 deletions
|
@ -154,6 +154,25 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
this.showStylus = function() {
|
||||
if (this.stylus) {
|
||||
var X_ROT_NEG_90 = { x: -0.70710678, y: 0, z: 0, w: 0.70710678 };
|
||||
var modelOrientation = Quat.multiply(this.stylusTip.orientation, X_ROT_NEG_90);
|
||||
var modelOrientationAngles = Quat.safeEulerAngles(modelOrientation);
|
||||
|
||||
var rotation = Overlays.getProperty(this.stylus, "rotation");
|
||||
var rotationAngles = Quat.safeEulerAngles(rotation);
|
||||
|
||||
if(!Vec3.withinEpsilon(modelOrientationAngles, rotationAngles, 1)) {
|
||||
var modelPositionOffset = Vec3.multiplyQbyV(modelOrientation, { x: 0, y: 0, z: MyAvatar.sensorToWorldScale * -WEB_STYLUS_LENGTH / 2 });
|
||||
|
||||
var updatedStylusProperties = {
|
||||
position: Vec3.sum(this.stylusTip.position, modelPositionOffset),
|
||||
rotation: modelOrientation,
|
||||
dimensions: Vec3.multiply(MyAvatar.sensorToWorldScale, { x: 0.01, y: 0.01, z: WEB_STYLUS_LENGTH }),
|
||||
};
|
||||
|
||||
Overlays.editOverlay(this.stylus, updatedStylusProperties);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue