mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 02:31:13 +02:00
fix tablet button and gizmos rotation
This commit is contained in:
parent
33e061b09b
commit
618a1d5b83
2 changed files with 12 additions and 15 deletions
|
@ -413,30 +413,31 @@ EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& ove
|
||||||
overlayProps["dimensions"] = vec3toVariant(ratio * dimensions);
|
overlayProps["dimensions"] = vec3toVariant(ratio * dimensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (add || overlayProps.contains("rotation")) {
|
if (add && !overlayProps.contains("rotation") && !overlayProps.contains("localRotation")) {
|
||||||
|
glm::quat rotation;
|
||||||
|
overlayProps["rotation"] = quatToVariant(glm::angleAxis(-(float)M_PI_2, rotation * Vectors::RIGHT) * rotation);
|
||||||
|
} else if (overlayProps.contains("rotation")) {
|
||||||
glm::quat rotation;
|
glm::quat rotation;
|
||||||
{
|
{
|
||||||
auto iter = overlayProps.find("rotation");
|
auto iter = overlayProps.find("rotation");
|
||||||
if (iter != overlayProps.end()) {
|
if (iter != overlayProps.end()) {
|
||||||
rotation = quatFromVariant(iter.value());
|
rotation = quatFromVariant(iter.value());
|
||||||
} else if (!add) {
|
|
||||||
EntityPropertyFlags desiredProperties;
|
|
||||||
desiredProperties += PROP_ROTATION;
|
|
||||||
rotation = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(id, desiredProperties).getRotation();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
overlayProps["rotation"] = quatToVariant(glm::angleAxis(-(float)M_PI_2, rotation * Vectors::RIGHT) * rotation);
|
overlayProps["rotation"] = quatToVariant(glm::angleAxis(-(float)M_PI_2, rotation * Vectors::RIGHT) * rotation);
|
||||||
}
|
|
||||||
if (add || overlayProps.contains("localRotation")) {
|
if (overlayProps.contains("localRotation")) {
|
||||||
|
auto iter = overlayProps.find("localRotation");
|
||||||
|
if (iter != overlayProps.end()) {
|
||||||
|
overlayProps.erase(iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (overlayProps.contains("localRotation")) {
|
||||||
glm::quat rotation;
|
glm::quat rotation;
|
||||||
{
|
{
|
||||||
auto iter = overlayProps.find("localRotation");
|
auto iter = overlayProps.find("localRotation");
|
||||||
if (iter != overlayProps.end()) {
|
if (iter != overlayProps.end()) {
|
||||||
rotation = quatFromVariant(iter.value());
|
rotation = quatFromVariant(iter.value());
|
||||||
} else if (!add) {
|
|
||||||
EntityPropertyFlags desiredProperties;
|
|
||||||
desiredProperties += PROP_LOCAL_ROTATION;
|
|
||||||
rotation = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(id, desiredProperties).getLocalRotation();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
overlayProps["localRotation"] = quatToVariant(glm::angleAxis(-(float)M_PI_2, rotation * Vectors::RIGHT) * rotation);
|
overlayProps["localRotation"] = quatToVariant(glm::angleAxis(-(float)M_PI_2, rotation * Vectors::RIGHT) * rotation);
|
||||||
|
|
|
@ -418,13 +418,11 @@ resizeTablet = function (width, newParentJointIndex, sensorToWorldScaleOverride)
|
||||||
var HOME_BUTTON_Z_OFFSET = (tabletDepth / 1.9) * sensorScaleOffsetOverride;
|
var HOME_BUTTON_Z_OFFSET = (tabletDepth / 1.9) * sensorScaleOffsetOverride;
|
||||||
Entities.editEntity(HMD.homeButtonID, {
|
Entities.editEntity(HMD.homeButtonID, {
|
||||||
localPosition: { x: HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
localPosition: { x: HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
||||||
localRotation: { x: 0, y: 1, z: 0, w: 0 },
|
|
||||||
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
||||||
});
|
});
|
||||||
|
|
||||||
Entities.editEntity(HMD.homeButtonHighlightID, {
|
Entities.editEntity(HMD.homeButtonHighlightID, {
|
||||||
localPosition: { x: -HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
localPosition: { x: -HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
||||||
localRotation: { x: 0, y: 1, z: 0, w: 0 },
|
|
||||||
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -482,13 +480,11 @@ reparentAndScaleTablet = function(width, reparentProps) {
|
||||||
var HOME_BUTTON_Z_OFFSET = (tabletDepth / 1.9) * sensorScaleOffsetOverride;
|
var HOME_BUTTON_Z_OFFSET = (tabletDepth / 1.9) * sensorScaleOffsetOverride;
|
||||||
Entities.editEntity(HMD.homeButtonID, {
|
Entities.editEntity(HMD.homeButtonID, {
|
||||||
localPosition: { x: HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
localPosition: { x: HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
||||||
localRotation: { x: 0, y: 1, z: 0, w: 0 },
|
|
||||||
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
||||||
});
|
});
|
||||||
|
|
||||||
Entities.editEntity(HMD.homeButtonHighlightID, {
|
Entities.editEntity(HMD.homeButtonHighlightID, {
|
||||||
localPosition: { x: -HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
localPosition: { x: -HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
||||||
localRotation: { x: 0, y: 1, z: 0, w: 0 },
|
|
||||||
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue