Scott Lawrence avatar Scott Lawrence committed e2ec80d

SH-1319: Fix for disappearing torso sections on avatars

Comments (0)

Files changed (2)

indra/newview/llphysicsmotion.cpp

         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)
                 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);
         //
         // End calculate new params
         ////////////////////////////////////////////////////////////////////////////////
-        
+
         ////////////////////////////////////////////////////////////////////////////////
         // Conditionally update the visual params
         //

indra/newview/llpolymorph.cpp

 
 	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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.