diff options
Diffstat (limited to 'indra/newview')
| -rwxr-xr-x | indra/newview/llvoavatar.cpp | 20 | ||||
| -rwxr-xr-x | indra/newview/llvoavatar.h | 2 | 
2 files changed, 18 insertions, 4 deletions
| diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index b731f242ce..60796fec78 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -159,6 +159,9 @@ const F32 HEAD_MOVEMENT_AVG_TIME = 0.9f;  const S32 MORPH_MASK_REQUESTED_DISCARD = 0; +const F32 MAX_STANDOFF_FROM_ORIGIN = 3; +const F32 MAX_STANDOFF_DISTANCE_CHANGE = 32; +  // Discard level at which to switch to baked textures  // Should probably be 4 or 3, but didn't want to change it while change other logic - SJB  const S32 SWITCH_TO_BAKED_DISCARD = 5; @@ -2131,7 +2134,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)  	// animate the character  	// store off last frame's root position to be consistent with camera position -	LLVector3 root_pos_last = mRoot->getWorldPosition(); +	mLastRootPos = mRoot->getWorldPosition();  	BOOL detailed_update = updateCharacter(agent);  	static LLUICachedControl<bool> visualizers_in_calls("ShowVoiceVisualizersInCalls", false); @@ -2149,7 +2152,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)  		idleUpdateWindEffect();  	} -	idleUpdateNameTag( root_pos_last ); +	idleUpdateNameTag( mLastRootPos );  	idleUpdateRenderCost();  } @@ -6053,10 +6056,10 @@ void LLVOAvatar::getOffObject()  	{  		return;  	} -	 +  	LLViewerObject* sit_object = (LLViewerObject*)getParent(); -	if (sit_object)  +	if (sit_object)  	{  		stopMotionFromSource(sit_object->getID());  		LLFollowCamMgr::setCameraActive(sit_object->getID(), FALSE); @@ -6077,6 +6080,15 @@ void LLVOAvatar::getOffObject()  	LLVector3 cur_position_world = mDrawable->getWorldPosition();  	LLQuaternion cur_rotation_world = mDrawable->getWorldRotation(); +	if (mLastRootPos.length() >= MAX_STANDOFF_FROM_ORIGIN +		&& (cur_position_world.length() < MAX_STANDOFF_FROM_ORIGIN +			|| dist_vec(cur_position_world, mLastRootPos) > MAX_STANDOFF_DISTANCE_CHANGE)) +	{ +		// Most likely drawable got updated too early or some updates were missed - we got relative position to non-existing parent +		// restore coordinates from cache +		cur_position_world = mLastRootPos; +	} +  	// set *local* position based on last *world* position, since we're unparenting the avatar  	mDrawable->mXform.setPosition(cur_position_world);  	mDrawable->mXform.setRotation(cur_rotation_world);	 diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 1c3f4f2aa7..5b4379165a 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -869,6 +869,8 @@ public:  private:  	// set this property only with LLVOAvatar::sitDown method  	BOOL 			mIsSitting; +	// position backup in case of missing data +	LLVector3		mLastRootPos;  /**                    Hierarchy   **                                                                            ** | 
