mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:08:54 +02:00
Merge pull request #11517 from SamGondelman/registration
Fix entities with registration points rendering in the wrong place
This commit is contained in:
commit
75d2a2bd47
3 changed files with 3 additions and 3 deletions
|
@ -1368,7 +1368,7 @@ void EntityItem::recordCreationTime() {
|
||||||
const Transform EntityItem::getTransformToCenter(bool& success) const {
|
const Transform EntityItem::getTransformToCenter(bool& success) const {
|
||||||
Transform result = getTransform(success);
|
Transform result = getTransform(success);
|
||||||
if (getRegistrationPoint() != ENTITY_ITEM_HALF_VEC3) { // If it is not already centered, translate to center
|
if (getRegistrationPoint() != ENTITY_ITEM_HALF_VEC3) { // If it is not already centered, translate to center
|
||||||
result.postTranslate(ENTITY_ITEM_HALF_VEC3 - getRegistrationPoint()); // Position to center
|
result.postTranslate((ENTITY_ITEM_HALF_VEC3 - getRegistrationPoint()) * getDimensions()); // Position to center
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ bool TextEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const
|
||||||
glm::vec2 xyDimensions(dimensions.x, dimensions.y);
|
glm::vec2 xyDimensions(dimensions.x, dimensions.y);
|
||||||
glm::quat rotation = getRotation();
|
glm::quat rotation = getRotation();
|
||||||
glm::vec3 position = getPosition() + rotation *
|
glm::vec3 position = getPosition() + rotation *
|
||||||
(dimensions * (getRegistrationPoint() - ENTITY_ITEM_DEFAULT_REGISTRATION_POINT));
|
(dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint()));
|
||||||
|
|
||||||
// FIXME - should set face and surfaceNormal
|
// FIXME - should set face and surfaceNormal
|
||||||
return findRayRectangleIntersection(origin, direction, rotation, position, xyDimensions, distance);
|
return findRayRectangleIntersection(origin, direction, rotation, position, xyDimensions, distance);
|
||||||
|
|
|
@ -112,7 +112,7 @@ bool WebEntityItem::findDetailedRayIntersection(const glm::vec3& origin, const g
|
||||||
glm::vec3 dimensions = getDimensions();
|
glm::vec3 dimensions = getDimensions();
|
||||||
glm::vec2 xyDimensions(dimensions.x, dimensions.y);
|
glm::vec2 xyDimensions(dimensions.x, dimensions.y);
|
||||||
glm::quat rotation = getRotation();
|
glm::quat rotation = getRotation();
|
||||||
glm::vec3 position = getPosition() + rotation * (dimensions * (getRegistrationPoint() - ENTITY_ITEM_DEFAULT_REGISTRATION_POINT));
|
glm::vec3 position = getPosition() + rotation * (dimensions * (ENTITY_ITEM_DEFAULT_REGISTRATION_POINT - getRegistrationPoint()));
|
||||||
|
|
||||||
if (findRayRectangleIntersection(origin, direction, rotation, position, xyDimensions, distance)) {
|
if (findRayRectangleIntersection(origin, direction, rotation, position, xyDimensions, distance)) {
|
||||||
surfaceNormal = rotation * Vectors::UNIT_Z;
|
surfaceNormal = rotation * Vectors::UNIT_Z;
|
||||||
|
|
Loading…
Reference in a new issue