mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-22 14:13:46 +02:00
add support for avatar set/get parent Joint Index, as well
This commit is contained in:
parent
5ee1acc1ea
commit
41c46423ba
2 changed files with 28 additions and 2 deletions
|
@ -1209,3 +1209,27 @@ void Avatar::updatePalms() {
|
|||
_leftPalmPositionCache.set(leftPalmPosition);
|
||||
_rightPalmPositionCache.set(rightPalmPosition);
|
||||
}
|
||||
|
||||
void Avatar::setParentID(const QUuid& parentID) {
|
||||
bool success;
|
||||
Transform beforeChangeTransform = getTransform(success);
|
||||
SpatiallyNestable::setParentID(parentID);
|
||||
if (success) {
|
||||
setTransform(beforeChangeTransform, success);
|
||||
if (!success) {
|
||||
qDebug() << "Avatar::setParentID failed to reset avatar's location.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Avatar::setParentJointIndex(quint16 parentJointIndex) {
|
||||
bool success;
|
||||
Transform beforeChangeTransform = getTransform(success);
|
||||
SpatiallyNestable::setParentJointIndex(parentJointIndex);
|
||||
if (success) {
|
||||
setTransform(beforeChangeTransform, success);
|
||||
if (!success) {
|
||||
qDebug() << "Avatar::setParentJointIndex failed to reset avatar's location.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,9 +167,11 @@ public:
|
|||
using SpatiallyNestable::setOrientation;
|
||||
virtual void setOrientation(const glm::quat& orientation) override;
|
||||
|
||||
// these just call through to the SpatiallyNestable versions, but they are here to expose these to javascript.
|
||||
// these call through to the SpatiallyNestable versions, but they are here to expose these to javascript.
|
||||
Q_INVOKABLE virtual QUuid getParentID() const { return SpatiallyNestable::getParentID(); }
|
||||
Q_INVOKABLE virtual void setParentID(const QUuid& parentID) { SpatiallyNestable::setParentID(parentID); }
|
||||
Q_INVOKABLE virtual void setParentID(const QUuid& parentID);
|
||||
Q_INVOKABLE virtual quint16 getParentJointIndex() const { return SpatiallyNestable::getParentJointIndex(); }
|
||||
Q_INVOKABLE virtual void setParentJointIndex(quint16 parentJointIndex);
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
Loading…
Reference in a new issue