mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 12:53:44 +02:00
V8-related JS fixes
This commit is contained in:
parent
022bf6de8c
commit
6f92cf0330
6 changed files with 33 additions and 27 deletions
|
@ -567,6 +567,8 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
if (this.distanceHolding) {
|
||||
var targetProps = Entities.getEntityProperties(this.targetObject.entityID,
|
||||
["position", "rotation", "registrationPoint", "dimensions"]);
|
||||
if (controllerData.rayPicks[this.hand].intersection == null)
|
||||
return undefined;
|
||||
return worldPositionToRegistrationFrameMatrix(targetProps, controllerData.rayPicks[this.hand].intersection);
|
||||
}
|
||||
return undefined;
|
||||
|
|
|
@ -216,15 +216,21 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
avatarSensorPosition.y = 0;
|
||||
|
||||
var targetRotation = Entities.getEntityProperties(_this.targetOverlayID, ["rotation"]).rotation;
|
||||
var relativePlayAreaCenterOffset =
|
||||
Vec3.sum(_this.playAreaCenterOffset, { x: 0, y: -TARGET_MODEL_DIMENSIONS.y / 2, z: 0 });
|
||||
var localPosition = Vec3.multiplyQbyV(Quat.inverse(targetRotation),
|
||||
Vec3.multiplyQbyV(sensorToWorldRotation,
|
||||
Vec3.multiply(avatarScale, Vec3.subtract(relativePlayAreaCenterOffset, avatarSensorPosition))));
|
||||
localPosition.y = _this.teleportScaleFactor * localPosition.y;
|
||||
if (targetRotation != null) {
|
||||
var relativePlayAreaCenterOffset =
|
||||
Vec3.sum(_this.playAreaCenterOffset, {x: 0, y: -TARGET_MODEL_DIMENSIONS.y / 2, z: 0});
|
||||
var localPosition = Vec3.multiplyQbyV(Quat.inverse(targetRotation),
|
||||
Vec3.multiplyQbyV(sensorToWorldRotation,
|
||||
Vec3.multiply(avatarScale, Vec3.subtract(relativePlayAreaCenterOffset, avatarSensorPosition))));
|
||||
localPosition.y = _this.teleportScaleFactor * localPosition.y;
|
||||
} else {
|
||||
print("");
|
||||
}
|
||||
|
||||
playAreaOverlayProperties.parentID = _this.targetOverlayID;
|
||||
playAreaOverlayProperties.localPosition = localPosition;
|
||||
if (targetRotation != null) {
|
||||
playAreaOverlayProperties.localPosition = localPosition;
|
||||
}
|
||||
}
|
||||
|
||||
Overlays.editOverlay(_this.playAreaOverlay, playAreaOverlayProperties);
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
var selectionDisplay = SelectionDisplay;
|
||||
selectionDisplay.createApp = createApp;
|
||||
var selectionManager = SelectionManager;
|
||||
selectionManager.createApp = createApp;
|
||||
|
||||
var PARTICLE_SYSTEM_URL = Script.resolvePath("assets/images/icon-particles.svg");
|
||||
var POINT_LIGHT_URL = Script.resolvePath("assets/images/icon-point-light.svg");
|
||||
|
@ -114,8 +115,8 @@
|
|||
}
|
||||
});
|
||||
|
||||
var hmdMultiSelectMode = false;
|
||||
var expectingRotateAsClickedSurface = false;
|
||||
createApp.hmdMultiSelectMode = false;
|
||||
createApp.expectingRotateAsClickedSurface = false;
|
||||
var keepSelectedOnNextClick = false;
|
||||
|
||||
var copiedPosition;
|
||||
|
@ -1236,11 +1237,11 @@
|
|||
}
|
||||
|
||||
var result;
|
||||
if (expectingRotateAsClickedSurface) {
|
||||
if (createApp.expectingRotateAsClickedSurface) {
|
||||
if (!SelectionManager.hasSelection() || !SelectionManager.hasUnlockedSelection()) {
|
||||
audioFeedback.rejection();
|
||||
Window.notifyEditError("You have nothing selected, or the selection is locked.");
|
||||
expectingRotateAsClickedSurface = false;
|
||||
createApp.expectingRotateAsClickedSurface = false;
|
||||
} else {
|
||||
//Rotate Selection according the Surface Normal
|
||||
var normalRotation = Quat.lookAtSimple(Vec3.ZERO, Vec3.multiply(entityResult.surfaceNormal, -1));
|
||||
|
@ -1255,7 +1256,7 @@
|
|||
selectionDisplay.moveSelection(Vec3.sum(entityResult.intersection, Vec3.multiplyQbyV( normalRotation, {"x": 0.0, "y":0.0, "z": distanceFromSurface})));
|
||||
selectionManager._update(false, this);
|
||||
createApp.pushCommandForSelections();
|
||||
expectingRotateAsClickedSurface = false;
|
||||
createApp.expectingRotateAsClickedSurface = false;
|
||||
audioFeedback.action();
|
||||
}
|
||||
keepSelectedOnNextClick = true;
|
||||
|
@ -1299,7 +1300,7 @@
|
|||
var entity = entityIconOverlayManager.findEntity(data.overlayID);
|
||||
|
||||
if (entity !== null) {
|
||||
if (hmdMultiSelectMode) {
|
||||
if (createApp.hmdMultiSelectMode) {
|
||||
selectionManager.addEntity(entity, true, this);
|
||||
} else {
|
||||
selectionManager.setSelections([entity], this);
|
||||
|
@ -2510,7 +2511,7 @@
|
|||
webView.setLandscape(true);
|
||||
} else {
|
||||
if (!visible) {
|
||||
hmdMultiSelectMode = false;
|
||||
createApp.hmdMultiSelectMode = false;
|
||||
webView.setLandscape(false);
|
||||
}
|
||||
}
|
||||
|
@ -3278,9 +3279,9 @@
|
|||
if (!SelectionManager.hasSelection() || !SelectionManager.hasUnlockedSelection()) {
|
||||
audioFeedback.rejection();
|
||||
Window.notifyEditError("You have nothing selected, or the selection is locked.");
|
||||
expectingRotateAsClickedSurface = false;
|
||||
createApp.expectingRotateAsClickedSurface = false;
|
||||
} else {
|
||||
expectingRotateAsClickedSurface = true;
|
||||
createApp.expectingRotateAsClickedSurface = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) {
|
|||
} else if (data.type === 'unparent') {
|
||||
that.createApp.unparentSelectedEntities();
|
||||
} else if (data.type === 'hmdMultiSelectMode') {
|
||||
hmdMultiSelectMode = data.value;
|
||||
that.createApp.hmdMultiSelectMode = data.value;
|
||||
} else if (data.type === 'selectAllInBox') {
|
||||
that.createApp.selectAllEntitiesInCurrentSelectionBox(false);
|
||||
} else if (data.type === 'selectAllTouchingBox') {
|
||||
|
|
|
@ -88,11 +88,9 @@ SelectionManager = (function() {
|
|||
if (channel !== 'entityToolUpdates') {
|
||||
return;
|
||||
}
|
||||
print("handleEntitySelectionToolUpdates entityToolUpdates");
|
||||
if (sender !== MyAvatar.sessionUUID) {
|
||||
return;
|
||||
}
|
||||
print("handleEntitySelectionToolUpdates MyAvatar.sessionUUID");
|
||||
|
||||
var wantDebug = false;
|
||||
var messageParsed;
|
||||
|
@ -112,11 +110,11 @@ SelectionManager = (function() {
|
|||
if (wantDebug) {
|
||||
print("setting selection to " + messageParsed.entityID);
|
||||
}
|
||||
if (expectingRotateAsClickedSurface) {
|
||||
if (that.createApp.expectingRotateAsClickedSurface) {
|
||||
if (!SelectionManager.hasSelection() || !SelectionManager.hasUnlockedSelection()) {
|
||||
audioFeedback.rejection();
|
||||
Window.notifyEditError("You have nothing selected, or the selection is locked.");
|
||||
expectingRotateAsClickedSurface = false;
|
||||
that.createApp.expectingRotateAsClickedSurface = false;
|
||||
} else {
|
||||
//Rotate Selection according the Surface Normal
|
||||
var normalRotation = Quat.lookAtSimple(Vec3.ZERO, Vec3.multiply(messageParsed.surfaceNormal, -1));
|
||||
|
@ -131,7 +129,7 @@ SelectionManager = (function() {
|
|||
selectionDisplay.moveSelection(Vec3.sum(messageParsed.intersection, Vec3.multiplyQbyV( normalRotation, {"x": 0.0, "y":0.0, "z": distanceFromSurface})));
|
||||
that._update(false, this);
|
||||
that.createApp.pushCommandForSelections();
|
||||
expectingRotateAsClickedSurface = false;
|
||||
that.createApp.expectingRotateAsClickedSurface = false;
|
||||
audioFeedback.action();
|
||||
}
|
||||
} else {
|
||||
|
@ -140,7 +138,7 @@ SelectionManager = (function() {
|
|||
if (intersectObj.intersects) {
|
||||
return;
|
||||
}
|
||||
if (hmdMultiSelectMode) {
|
||||
if (that.createApp.hmdMultiSelectMode) {
|
||||
that.addEntity(messageParsed.entityID, true, that);
|
||||
} else {
|
||||
that.setSelections([messageParsed.entityID], that);
|
||||
|
@ -152,7 +150,6 @@ SelectionManager = (function() {
|
|||
that.clearSelections();
|
||||
}
|
||||
} else if (messageParsed.method === "pointingAt") {
|
||||
print("handleEntitySelectionToolUpdates pointingAt");
|
||||
if (messageParsed.hand === Controller.Standard.RightHand) {
|
||||
that.pointingAtDesktopWindowRight = messageParsed.desktopWindow;
|
||||
that.pointingAtTabletRight = messageParsed.tablet;
|
||||
|
|
|
@ -563,8 +563,8 @@ var distanceBetweenPointAndEntityBoundingBox = function(point, entityProps) {
|
|||
var localPoint = entityXform.inv().xformPoint(point);
|
||||
var minOffset = Vec3.multiplyVbyV(entityProps.registrationPoint, entityProps.dimensions);
|
||||
var maxOffset = Vec3.multiplyVbyV(Vec3.subtract(ONE_VEC, entityProps.registrationPoint), entityProps.dimensions);
|
||||
var localMin = Vec3.subtract(entityXform.trans, minOffset);
|
||||
var localMax = Vec3.sum(entityXform.trans, maxOffset);
|
||||
var localMin = Vec3.subtract(entityXform.pos, minOffset);
|
||||
var localMax = Vec3.sum(entityXform.pos, maxOffset);
|
||||
|
||||
var v = {x: localPoint.x, y: localPoint.y, z: localPoint.z};
|
||||
v.x = Math.max(v.x, localMin.x);
|
||||
|
@ -589,7 +589,7 @@ var worldPositionToRegistrationFrameMatrix = function(wptrProps, pos) {
|
|||
// get world matrix for intersection point
|
||||
var intersectionMat = new Xform({ x: 0, y: 0, z:0, w: 1 }, pos);
|
||||
|
||||
// calculate world matrix for registrationPoint addjusted entity
|
||||
// calculate world matrix for registrationPoint adjusted entity
|
||||
var DEFAULT_REGISTRATION_POINT = { x: 0.5, y: 0.5, z: 0.5 };
|
||||
var regRatio = Vec3.subtract(DEFAULT_REGISTRATION_POINT, wptrProps.registrationPoint);
|
||||
var regOffset = Vec3.multiplyVbyV(regRatio, wptrProps.dimensions);
|
||||
|
|
Loading…
Reference in a new issue