summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2018-10-03 13:11:50 +0100
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2018-10-03 13:11:50 +0100
commit8078b30574fc0a317b8dc7aadfc09516d3638ab0 (patch)
treeb94815937800d5d9bb68a12232307fbb7567702e /indra/newview
parent0fd67838cf011e81f18822f699e8a140d4f761ad (diff)
SL-966 - bug fixes, added lerp control for algorithm tweaking
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llcontrolavatar.cpp8
2 files changed, 18 insertions, 1 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 3ad8b6cded..bacd2c992b 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -2259,6 +2259,17 @@
<key>Value</key>
<real>64.0</real>
</map>
+ <key>AnimatedObjectsPosLerp</key>
+ <map>
+ <key>Comment</key>
+ <string>How strongly to weight new position vs. previous frame in position constraints.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.0</real>
+ </map>
<key>AvatarBoundingBoxComplexity</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llcontrolavatar.cpp b/indra/newview/llcontrolavatar.cpp
index 64f8423a66..96aaab80fa 100644
--- a/indra/newview/llcontrolavatar.cpp
+++ b/indra/newview/llcontrolavatar.cpp
@@ -87,6 +87,11 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
{
max_legal_size = gSavedSettings.getF32("AnimatedObjectsMaxLegalSize");
}
+ F32 lerp_weight = 0.5f; // hysteresis. 1.0 = immediately slam to new value, 0.0 = ignore new value
+ if (gSavedSettings.getControl("AnimatedObjectsPosLerp"))
+ {
+ lerp_weight = gSavedSettings.getF32("AnimatedObjectsPosLerp");
+ }
new_pos_fixup = LLVector3();
new_scale_fixup = 1.0f;
@@ -102,7 +107,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
// correction to the control avatar position if
// needed.
const LLVector3 *extents = getLastAnimExtents();
- LLVector unshift_extents;
+ LLVector3 unshift_extents[2];
unshift_extents[0] = extents[0] - mPositionConstraintFixup;
unshift_extents[1] = extents[1] - mPositionConstraintFixup;
LLVector3 box_dims = extents[1]-extents[0];
@@ -116,6 +121,7 @@ void LLControlAvatar::getNewConstraintFixups(LLVector3& new_pos_fixup, F32& new_
LL_DEBUGS("ConstraintFix") << getFullname() << " pos fix, offset_dist " << offset_dist << " pos fixup "
<< new_pos_fixup << " was " << mPositionConstraintFixup << LL_ENDL;
}
+ new_pos_fixup = lerp_weight * new_pos_fixup + (1.0f - lerp_weight)*mPositionConstraintFixup;
if (max_size/mScaleConstraintFixup > max_legal_size)
{
new_scale_fixup = mScaleConstraintFixup*max_legal_size/max_size;