diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llphysicsmotion.cpp | 25 | ||||
-rw-r--r-- | indra/newview/llpolymorph.cpp | 10 |
2 files changed, 31 insertions, 4 deletions
diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index cb7a55320a..7799ef04e6 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -40,6 +40,7 @@ #include "v3dmath.h" #include "llphysicsmotion.h" +#include "llagent.h" #include "llcharacter.h" #include "llviewercontrol.h" #include "llviewervisualparam.h" @@ -472,7 +473,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) const F32 behavior_gain = getParamValue("Gain"); const F32 behavior_damping = getParamValue("Damping"); const F32 behavior_drag = getParamValue("Drag"); - const BOOL physics_test = gSavedSettings.getBOOL("AvatarPhysicsTest"); + const BOOL physics_test = gSavedSettings.getBOOL("AvatarPhysicsTest") && gAgent.isGodlike(); F32 behavior_maxeffect = getParamValue("MaxEffect"); if (physics_test) @@ -583,9 +584,25 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) velocity_new_local = 0; } + // Check for NaN values. A NaN value is detected if the variables doesn't equal itself. + // If NaN, then reset everything. + if ((mPosition_local != mPosition_local) || + (mVelocity_local != mVelocity_local) || + (position_new_local != position_new_local)) + { + position_new_local = 0; + position_current_local = 0; + position_user_local = 0; + mVelocity_local = 0; + mVelocityJoint_local = 0; + mAccelerationJoint_local = 0; + mPosition_local = 0; + mPosition_world = LLVector3(0,0,0); + } + const F32 position_new_local_clamped = llclamp(position_new_local, - min_val, - max_val); + min_val, + max_val); LLDriverParam *driver_param = dynamic_cast<LLDriverParam *>(mParamDriver); llassert_always(driver_param); @@ -613,7 +630,7 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) // // End calculate new params //////////////////////////////////////////////////////////////////////////////// - + //////////////////////////////////////////////////////////////////////////////// // Conditionally update the visual params // diff --git a/indra/newview/llpolymorph.cpp b/indra/newview/llpolymorph.cpp index 5a67fd482a..36f8c8d13e 100644 --- a/indra/newview/llpolymorph.cpp +++ b/indra/newview/llpolymorph.cpp @@ -490,6 +490,16 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) mLastSex = avatar_sex; + // Check for NaN condition (NaN is detected if a variable doesn't equal itself. + if (mCurWeight != mCurWeight) + { + mCurWeight = 0.0; + } + if (mLastWeight != mLastWeight) + { + mLastWeight = mCurWeight+.001; + } + // perform differential update of morph F32 delta_weight = ( getSex() & avatar_sex ) ? (mCurWeight - mLastWeight) : (getDefaultWeight() - mLastWeight); // store last weight |