got rid of the lag in the spline code by setting the flex coeffs to 1.0

This commit is contained in:
amantley 2019-01-25 17:11:07 -08:00
parent bcbd9323c0
commit f2a7f37950
9 changed files with 20 additions and 41 deletions

View file

@ -194,8 +194,8 @@
"enabledVar": "splineIKEnabled",
"endEffectorRotationVarVar": "splineIKRotationVar",
"endEffectorPositionVarVar": "splineIKPositionVar",
"primaryFlexCoefficients": "1, 0.5, 0.25, 0.2, 0.1",
"secondaryFlexCoefficients": "1.0, 0.5, 0.25"
"primaryFlexCoefficients": "1.0, 1.0, 1.0, 1.0, 1.0",
"secondaryFlexCoefficients": "1.0, 1.0, 1.0"
},
"children": [
{

View file

@ -4814,6 +4814,7 @@ void setupCpuMonitorThread() {
void Application::idle() {
PerformanceTimer perfTimer("idle");
// Update the deadlock watchdog
updateHeartbeat();

View file

@ -82,16 +82,6 @@ public:
return foundIndex;
}
const AnimPose& getRelativePoseAtJointIndex(int jointIndex) const {
for (int i = 0; i < _top; i++) {
if (_chain[i].jointIndex == jointIndex) {
return _chain[i].relativePose;
}
}
return AnimPose::identity;
}
void buildDirtyAbsolutePoses() {
// the relative and absolute pose is the same for the base of the chain.
_chain[_top - 1].absolutePose = _chain[_top - 1].relativePose;

View file

@ -134,7 +134,6 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const
glm::vec3 hipsTargetTranslation;
// now we override the hips with the hips target pose.
////////////////////////////////////////////////////
if (_poses.size() > 0) {
AnimPose hipsUnderPose = _skeleton->getAbsolutePose(_hipsIndex, _poses);
hipsTargetRotation = animVars.lookupRigToGeometry("hipsRotation", hipsUnderPose.rot());
@ -147,7 +146,6 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const
_poses[_hipsIndex] = hipsParentAbsPose.inverse() * absHipsTargetPose;
_poses[_hipsIndex].scale() = glm::vec3(1.0f);
}
//////////////////////////////////////////////////////////////////////////////////
AnimPoseVec absolutePoses;
absolutePoses.resize(_poses.size());
@ -186,12 +184,10 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const
AnimPose afterSolveSecondaryTarget = _skeleton->getAbsolutePose(_secondaryTargetIndex, _poses);
glm::quat secondaryTargetRotation = animVars.lookupRigToGeometry(_secondaryTargetRotationVar, afterSolveSecondaryTarget.rot());
updatedSecondaryTarget = AnimPose(secondaryTargetRotation, afterSolveSecondaryTarget.trans());
//updatedSecondaryTarget = AnimPose(afterSolveSecondaryTarget.rot(), afterSolveSecondaryTarget.trans());
}
IKTarget secondaryTarget;
computeAbsolutePoses(absolutePoses2);
if (_secondaryTargetIndex != -1) {
@ -199,7 +195,6 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const
secondaryTarget.setIndex(_secondaryTargetIndex);
float weight2 = 1.0f;
secondaryTarget.setPose(updatedSecondaryTarget.rot(), updatedSecondaryTarget.trans());
secondaryTarget.setWeight(weight2);
@ -223,15 +218,9 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const
int tipParent = _skeleton->getParentIndex(_tipJointIndex);
int secondaryTargetParent = _skeleton->getParentIndex(_secondaryTargetIndex);
if ((secondaryTargetParent != -1) && (tipParent != -1) && (_poses.size() > 0)) {
/*
AnimPose secondaryTargetPose(target2.getRotation(), target2.getTranslation());
AnimPose secondaryTargetRelativePose = _skeleton->getAbsolutePose(secondaryTargetParent, _poses).inverse() * secondaryTargetPose;
_poses[_secondaryTargetIndex] = secondaryTargetRelativePose;
*/
AnimPose secondaryTargetPose(secondaryTarget.getRotation(), secondaryTarget.getTranslation());
AnimPose neckAbsolute = _skeleton->getAbsolutePose(tipParent, _poses);
//AnimPose finalNeckAbsolute = AnimPose(safeLerp(target2.getRotation(), target.getRotation(), 1.0f),neckAbsolute.trans());
_poses[tipParent] = secondaryTargetPose.inverse() * beforeSolveChestNeck;
AnimPose tipTarget(target.getRotation(),target.getTranslation());

View file

@ -89,7 +89,7 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const
}
_enabled = enabled;
// don't build chains or do IK if we are disabled & not interping.
// don't build chains or do IK if we are disbled & not interping.
if (_interpType == InterpType::None && !enabled) {
_poses = underPoses;
return _poses;

View file

@ -1314,7 +1314,6 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr
joint.inverseBindRotation = joint.inverseDefaultRotation;
joint.name = fbxModel.name;
if (hfmModel.hfmToHifiJointNameMapping.contains(hfmModel.hfmToHifiJointNameMapping.key(joint.name))) {
// qCDebug(modelformat) << "joint name " << joint.name << " hifi name " << hfmModel.hfmToHifiJointNameMapping.key(fbxModel.name);
joint.name = hfmModel.hfmToHifiJointNameMapping.key(fbxModel.name);
}