mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 03:52:45 +02:00
Fixed support for calling setJointMumblers with joint name. Walk.js runs smooth now!
This commit is contained in:
parent
8111432088
commit
c99573ea64
4 changed files with 27 additions and 8 deletions
|
@ -82,7 +82,7 @@ Avatar = function() {
|
|||
|
||||
// only need to zero right leg IK chain and hips
|
||||
if (IKChain === "RightLeg" || joint === "Hips" ) {
|
||||
MyAvatar.setJointRotation(MyAvatar.jointNames.indexOf(joint), Quat.fromPitchYawRollDegrees(0, 0, 0));
|
||||
MyAvatar.setJointRotation(joint, Quat.fromPitchYawRollDegrees(0, 0, 0));
|
||||
}
|
||||
}
|
||||
this.calibration.hipsToFeet = MyAvatar.getJointPosition("Hips").y - MyAvatar.getJointPosition("RightToeBase").y;
|
||||
|
@ -112,16 +112,16 @@ Avatar = function() {
|
|||
this.poseFingers = function() {
|
||||
for (knuckle in walkAssets.animationReference.leftHand) {
|
||||
if (walkAssets.animationReference.leftHand[knuckle].IKChain === "LeftHandThumb") {
|
||||
MyAvatar.setJointRotation(MyAvatar.jointNames.indexOf(knuckle), Quat.fromPitchYawRollDegrees(0, 0, -4));
|
||||
MyAvatar.setJointRotation(knuckle, Quat.fromPitchYawRollDegrees(0, 0, -4));
|
||||
} else {
|
||||
MyAvatar.setJointRotation(MyAvatar.jointNames.indexOf(knuckle), Quat.fromPitchYawRollDegrees(16, 0, 5));
|
||||
MyAvatar.setJointRotation(knuckle, Quat.fromPitchYawRollDegrees(16, 0, 5));
|
||||
}
|
||||
}
|
||||
for (knuckle in walkAssets.animationReference.rightHand) {
|
||||
if (walkAssets.animationReference.rightHand[knuckle].IKChain === "RightHandThumb") {
|
||||
MyAvatar.setJointRotation(MyAvatar.jointNames.indexOf(knuckle), Quat.fromPitchYawRollDegrees(0, 0, 4));
|
||||
MyAvatar.setJointRotation(knuckle, Quat.fromPitchYawRollDegrees(0, 0, 4));
|
||||
} else {
|
||||
MyAvatar.setJointRotation(MyAvatar.jointNames.indexOf(knuckle), Quat.fromPitchYawRollDegrees(16, 0, -5));
|
||||
MyAvatar.setJointRotation(knuckle, Quat.fromPitchYawRollDegrees(16, 0, -5));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -449,6 +449,6 @@ function renderMotion() {
|
|||
}
|
||||
|
||||
// apply rotations
|
||||
MyAvatar.setJointRotation(MyAvatar.jointNames.indexOf(jointName), Quat.fromVec3Degrees(jointRotations));
|
||||
MyAvatar.setJointRotation(jointName, Quat.fromVec3Degrees(jointRotations));
|
||||
}
|
||||
}
|
|
@ -1032,13 +1032,30 @@ glm::vec3 AvatarData::getJointTranslation(const QString& name) const {
|
|||
|
||||
void AvatarData::setJointData(const QString& name, const glm::quat& rotation, const glm::vec3& translation) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setJointData", Q_ARG(const QString&, name),
|
||||
Q_ARG(const glm::quat&, rotation));
|
||||
QMetaObject::invokeMethod(this, "setJointData", Q_ARG(const QString&, name), Q_ARG(const glm::quat&, rotation),
|
||||
Q_ARG(const glm::vec3&, translation));
|
||||
return;
|
||||
}
|
||||
setJointData(getJointIndex(name), rotation, translation);
|
||||
}
|
||||
|
||||
void AvatarData::setJointRotation(const QString& name, const glm::quat& rotation) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setJointRotation", Q_ARG(const QString&, name), Q_ARG(const glm::quat&, rotation));
|
||||
return;
|
||||
}
|
||||
setJointRotation(getJointIndex(name), rotation);
|
||||
}
|
||||
|
||||
void AvatarData::setJointTranslation(const QString& name, const glm::vec3& translation) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setJointTranslation", Q_ARG(const QString&, name),
|
||||
Q_ARG(const glm::vec3&, translation));
|
||||
return;
|
||||
}
|
||||
setJointTranslation(getJointIndex(name), translation);
|
||||
}
|
||||
|
||||
void AvatarData::setJointRotation(int index, const glm::quat& rotation) {
|
||||
if (index == -1) {
|
||||
return;
|
||||
|
|
|
@ -251,6 +251,8 @@ public:
|
|||
Q_INVOKABLE virtual glm::vec3 getJointTranslation(int index) const;
|
||||
|
||||
Q_INVOKABLE void setJointData(const QString& name, const glm::quat& rotation, const glm::vec3& translation);
|
||||
Q_INVOKABLE void setJointRotation(const QString& name, const glm::quat& rotation);
|
||||
Q_INVOKABLE void setJointTranslation(const QString& name, const glm::vec3& translation);
|
||||
Q_INVOKABLE void clearJointData(const QString& name);
|
||||
Q_INVOKABLE bool isJointDataValid(const QString& name) const;
|
||||
Q_INVOKABLE glm::quat getJointRotation(const QString& name) const;
|
||||
|
|
Loading…
Reference in a new issue