diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2017-09-08 16:05:49 +0100 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2017-09-08 16:05:49 +0100 |
commit | 2aa890da0bd8b42493745daa736c5ed9451bbf91 (patch) | |
tree | ff1af773b8300a7e804c4bb90d3ef2a2e59ab8ba /indra/newview/llcontrolavatar.cpp | |
parent | 943a1f3e802ee75683266a9a5d24ae4610207232 (diff) |
SL-718 - better support for transforms of animated attachments
Diffstat (limited to 'indra/newview/llcontrolavatar.cpp')
-rw-r--r-- | indra/newview/llcontrolavatar.cpp | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp index d458e2951b..172816b3e3 100644 --- a/indra/newview/llcontrolavatar.cpp +++ b/indra/newview/llcontrolavatar.cpp @@ -50,6 +50,8 @@ LLControlAvatar::~LLControlAvatar() void LLControlAvatar::matchVolumeTransform() { +#if 0 + // AXON - should we be using bind_shape? { LLVolume *volume = mRootVolp->getVolume(); if (volume) @@ -63,16 +65,40 @@ void LLControlAvatar::matchVolumeTransform() } } } - - setPositionAgent(mRootVolp->getRenderPosition()); - //slamPosition(); - - LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); - LLQuaternion obj_rot = mRootVolp->getRotation(); - LLQuaternion result_rot = fix_axes_rot * obj_rot; - setRotation(result_rot); - mRoot->setWorldRotation(result_rot); - mRoot->setPosition(mRootVolp->getRenderPosition()); +#endif + + + if (mRootVolp) + { + if (mRootVolp->isAttachment()) + { + LLVOAvatar *attached_av = mRootVolp->getAvatarAncestor(); + if (attached_av) + { + LLViewerJointAttachment *attach = attached_av->getTargetAttachmentPoint(mRootVolp); + setPositionAgent(mRootVolp->getRenderPosition()); + LLVector3 pos = attach->getParent()->getWorldPosition(); + mRoot->setWorldPosition(pos); + mRoot->setRotation(attach->getParent()->getWorldRotation()); + } + else + { + LL_WARNS_ONCE() << "can't find attached av!" << LL_ENDL; + } + } + else + { + setPositionAgent(mRootVolp->getRenderPosition()); + //slamPosition(); + + LLQuaternion fix_axes_rot(-F_PI_BY_TWO, LLVector3(0,0,1)); + LLQuaternion obj_rot = mRootVolp->getRotation(); + LLQuaternion result_rot = fix_axes_rot * obj_rot; + setRotation(result_rot); + mRoot->setWorldRotation(result_rot); + mRoot->setPosition(mRootVolp->getRenderPosition()); + } + } } void LLControlAvatar::setGlobalScale(F32 scale) |