mirror of
https://github.com/lubosz/overte.git
synced 2025-04-27 12:15:25 +02:00
added hook to myskeleton model to update spine2, need to get the rotation from myavatar then we have spine rot
This commit is contained in:
parent
0e0561bb24
commit
44a6c7df5f
2 changed files with 11 additions and 1 deletions
interface/src/avatar
|
@ -476,11 +476,13 @@ void MyAvatar::update(float deltaTime) {
|
|||
|
||||
// draw hand azimuth vector
|
||||
|
||||
glm::vec3 handAzimuthMidpoint = transformPoint(getTransform().getMatrix(), glm::vec3(_hipToHandController.x, 0.0f, _hipToHandController.y));
|
||||
glm::vec3 worldRHandAzimuth = transformPoint(getTransform().getMatrix(), getControllerPoseInAvatarFrame(controller::Action::RIGHT_HAND).getTranslation());
|
||||
glm::vec3 worldLHandAzimuth = transformPoint(getTransform().getMatrix(), getControllerPoseInAvatarFrame(controller::Action::LEFT_HAND).getTranslation());
|
||||
qCDebug(interfaceapp) << "the right hand in avatar space" << worldRHandAzimuth << " " << getWorldPosition();
|
||||
DebugDraw::getInstance().drawRay(getWorldPosition(), worldRHandAzimuth, glm::vec4(0.0f, 1.0f, 0.0f, 1.0f));
|
||||
DebugDraw::getInstance().drawRay(getWorldPosition(), worldLHandAzimuth, glm::vec4(0.0f, 1.0f, 0.0f, 1.0f));
|
||||
DebugDraw::getInstance().drawRay(getWorldPosition(), handAzimuthMidpoint, glm::vec4(0.0f, 1.0f, 1.0f, 1.0f));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -818,7 +820,7 @@ void MyAvatar::computeHandAzimuth() {
|
|||
|
||||
//qCDebug(interfaceapp) << "the right hand in avatar space" << rightHandRigSpace;
|
||||
|
||||
_hipToHandController = glm::vec2(rightHandRigSpace.x, rightHandRigSpace.z);
|
||||
_hipToHandController = lerp(glm::vec2(rightHandRigSpace.x, rightHandRigSpace.z), glm::vec2(leftHandRigSpace.x, leftHandRigSpace.z),0.5f);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -238,6 +238,14 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
|
|||
params.primaryControllerPoses[Rig::PrimaryControllerType_Hips] = sensorToRigPose * hips;
|
||||
params.primaryControllerFlags[Rig::PrimaryControllerType_Hips] = (uint8_t)Rig::ControllerFlags::Enabled | (uint8_t)Rig::ControllerFlags::Estimated;
|
||||
|
||||
|
||||
// spine 2 hack to be improved.
|
||||
AnimPose newSpinePose;
|
||||
bool fred = _rig.getAbsoluteJointPoseInRigFrame(_rig.indexOfJoint("Spine2"), newSpinePose);
|
||||
newSpinePose.rot() = glm::quat(0.7071f, 0.0f, 0.0f, 0.7071f)*newSpinePose.rot();
|
||||
params.primaryControllerPoses[Rig::PrimaryControllerType_Spine2] = newSpinePose;
|
||||
params.primaryControllerFlags[Rig::PrimaryControllerType_Spine2] = (uint8_t)Rig::ControllerFlags::Enabled | (uint8_t)Rig::ControllerFlags::Estimated;
|
||||
|
||||
} else {
|
||||
_prevHipsValid = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue