mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 16:36:54 +02:00
Merge pull request #11015 from davidkelly/dk/placeholderHighlighting
registration point fix
This commit is contained in:
commit
8f8f695e73
1 changed files with 8 additions and 4 deletions
|
@ -41,7 +41,12 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
||||||
if (_enabled && event.getButton() == PointerEvent::SecondaryButton) {
|
if (_enabled && event.getButton() == PointerEvent::SecondaryButton) {
|
||||||
|
|
||||||
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags);
|
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags);
|
||||||
glm::vec3 position = entityProperties.getPosition();
|
glm::vec3 bbPosition = entityProperties.getPosition();
|
||||||
|
glm::vec3 dimensions = entityProperties.getDimensions();
|
||||||
|
if (entityProperties.getRegistrationPoint() != glm::vec3(0.5f)) {
|
||||||
|
glm::vec3 adjustPos = entityProperties.getRegistrationPoint() - glm::vec3(0.5f);
|
||||||
|
bbPosition = bbPosition - (entityProperties.getRotation() * (adjustPos*dimensions));
|
||||||
|
}
|
||||||
if (entityProperties.getMarketplaceID().length() != 0) {
|
if (entityProperties.getMarketplaceID().length() != 0) {
|
||||||
qCDebug(context_overlay) << "Creating Context Overlay on top of entity with ID: " << entityItemID;
|
qCDebug(context_overlay) << "Creating Context Overlay on top of entity with ID: " << entityItemID;
|
||||||
_entityMarketplaceID = entityProperties.getMarketplaceID();
|
_entityMarketplaceID = entityProperties.getMarketplaceID();
|
||||||
|
@ -58,7 +63,7 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
||||||
}
|
}
|
||||||
_bbOverlay->setDimensions(entityProperties.getDimensions());
|
_bbOverlay->setDimensions(entityProperties.getDimensions());
|
||||||
_bbOverlay->setRotation(entityProperties.getRotation());
|
_bbOverlay->setRotation(entityProperties.getRotation());
|
||||||
_bbOverlay->setPosition(position);
|
_bbOverlay->setPosition(bbPosition);
|
||||||
_bbOverlay->setVisible(true);
|
_bbOverlay->setVisible(true);
|
||||||
|
|
||||||
if (_contextOverlayID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_contextOverlayID)) {
|
if (_contextOverlayID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_contextOverlayID)) {
|
||||||
|
@ -71,11 +76,10 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
||||||
_contextOverlay->setDrawInFront(true);
|
_contextOverlay->setDrawInFront(true);
|
||||||
_contextOverlay->setURL("http://i.imgur.com/gksZygp.png");
|
_contextOverlay->setURL("http://i.imgur.com/gksZygp.png");
|
||||||
_contextOverlay->setIsFacingAvatar(true);
|
_contextOverlay->setIsFacingAvatar(true);
|
||||||
_contextOverlay->setParentID(entityItemID);
|
|
||||||
_contextOverlayID = qApp->getOverlays().addOverlay(_contextOverlay);
|
_contextOverlayID = qApp->getOverlays().addOverlay(_contextOverlay);
|
||||||
}
|
}
|
||||||
glm::vec3 cameraPosition = qApp->getCamera().getPosition();
|
glm::vec3 cameraPosition = qApp->getCamera().getPosition();
|
||||||
float distanceToEntity = glm::distance(position, cameraPosition);
|
float distanceToEntity = glm::distance(bbPosition, cameraPosition);
|
||||||
glm::vec3 contextOverlayPosition;
|
glm::vec3 contextOverlayPosition;
|
||||||
glm::vec2 contextOverlayDimensions;
|
glm::vec2 contextOverlayDimensions;
|
||||||
if (distanceToEntity > 1.5f) {
|
if (distanceToEntity > 1.5f) {
|
||||||
|
|
Loading…
Reference in a new issue