mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
registration point
This commit is contained in:
parent
bab58efc3c
commit
10503c3a16
1 changed files with 7 additions and 3 deletions
|
@ -41,7 +41,12 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
|||
if (_enabled && event.getButton() == PointerEvent::SecondaryButton) {
|
||||
|
||||
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() * glm::vec3(adjustPos.x*dimensions.x, adjustPos.y*dimensions.y, adjustPos.z*dimensions.z));
|
||||
}
|
||||
if (entityProperties.getMarketplaceID().length() != 0) {
|
||||
qCDebug(context_overlay) << "Creating Context Overlay on top of entity with ID: " << entityItemID;
|
||||
_entityMarketplaceID = entityProperties.getMarketplaceID();
|
||||
|
@ -58,7 +63,7 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
|||
}
|
||||
_bbOverlay->setDimensions(entityProperties.getDimensions());
|
||||
_bbOverlay->setRotation(entityProperties.getRotation());
|
||||
_bbOverlay->setPosition(position);
|
||||
_bbOverlay->setPosition(bbPosition);
|
||||
_bbOverlay->setVisible(true);
|
||||
|
||||
if (_contextOverlayID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_contextOverlayID)) {
|
||||
|
@ -71,7 +76,6 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
|||
_contextOverlay->setDrawInFront(true);
|
||||
_contextOverlay->setURL("http://i.imgur.com/gksZygp.png");
|
||||
_contextOverlay->setIsFacingAvatar(true);
|
||||
_contextOverlay->setParentID(entityItemID);
|
||||
_contextOverlayID = qApp->getOverlays().addOverlay(_contextOverlay);
|
||||
}
|
||||
glm::vec3 cameraPosition = qApp->getCamera().getPosition();
|
||||
|
|
Loading…
Reference in a new issue