Fix Overlay-as-child of model entity with reg point

This fixes as issue where when you set the parent of an overlay to be a
model entity with a non-(0.5, 0.5, 0.5) registration point, the overlay would
still be positioned relative to the center of the model. The issue is
that the default parent joint index was 0, which is the center of the
model.

Entities had a default parent joint index of -1 (technically 65535
because it is a uint16). Avatars previously defaulted to 0, and that is
maintained here.
This commit is contained in:
Ryan Huffman 2017-01-23 16:08:01 -08:00
parent 9605379265
commit f0f5f8871c
2 changed files with 4 additions and 1 deletions

View file

@ -133,6 +133,7 @@ AvatarData::AvatarData() :
setBodyPitch(0.0f);
setBodyYaw(-90.0f);
setBodyRoll(0.0f);
setParentJointIndex(0);
ASSERT(sizeof(AvatarDataPacket::Header) == AvatarDataPacket::HEADER_SIZE);
ASSERT(sizeof(AvatarDataPacket::MinimalAvatarInfo) == AvatarDataPacket::MINIMAL_AVATAR_INFO_SIZE);

View file

@ -26,6 +26,8 @@ using SpatiallyNestableWeakConstPointer = std::weak_ptr<const SpatiallyNestable>
using SpatiallyNestablePointer = std::shared_ptr<SpatiallyNestable>;
using SpatiallyNestableConstPointer = std::shared_ptr<const SpatiallyNestable>;
static const uint16_t INVALID_JOINT_INDEX = -1;
enum class NestableType {
Entity,
Avatar,
@ -180,7 +182,7 @@ protected:
const NestableType _nestableType; // EntityItem or an AvatarData
QUuid _id;
QUuid _parentID; // what is this thing's transform relative to?
quint16 _parentJointIndex { 0 }; // which joint of the parent is this relative to?
quint16 _parentJointIndex { INVALID_JOINT_INDEX }; // which joint of the parent is this relative to?
mutable SpatiallyNestableWeakPointer _parent;