Skip to content
Snippets Groups Projects
Commit 27e13e73 authored by Kelly Washington's avatar Kelly Washington
Browse files

MAINT-2275 Child prims are "left behind" by animated, moving (physical) linksets

parent cebde0a3
No related branches found
No related tags found
No related merge requests found
...@@ -517,42 +517,45 @@ F32 LLDrawable::updateXform(BOOL undamped) ...@@ -517,42 +517,45 @@ F32 LLDrawable::updateXform(BOOL undamped)
F32 dist_squared = 0.f; F32 dist_squared = 0.f;
F32 camdist2 = (mDistanceWRTCamera * mDistanceWRTCamera); F32 camdist2 = (mDistanceWRTCamera * mDistanceWRTCamera);
if (damped && isVisible()) if (isVisible())
{ {
F32 lerp_amt = llclamp(LLCriticalDamp::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f); if (damped)
LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt); {
dist_squared = dist_vec_squared(new_pos, target_pos); F32 lerp_amt = llclamp(LLCriticalDamp::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f);
LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt);
dist_squared = dist_vec_squared(new_pos, target_pos);
LLQuaternion new_rot = nlerp(lerp_amt, old_rot, target_rot); LLQuaternion new_rot = nlerp(lerp_amt, old_rot, target_rot);
dist_squared += (1.f - dot(new_rot, target_rot)) * 10.f; dist_squared += (1.f - dot(new_rot, target_rot)) * 10.f;
LLVector3 new_scale = lerp(old_scale, target_scale, lerp_amt); LLVector3 new_scale = lerp(old_scale, target_scale, lerp_amt);
dist_squared += dist_vec_squared(new_scale, target_scale); dist_squared += dist_vec_squared(new_scale, target_scale);
if ((dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED * camdist2) && if ((dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED * camdist2) &&
(dist_squared <= MAX_INTERPOLATE_DISTANCE_SQUARED)) (dist_squared <= MAX_INTERPOLATE_DISTANCE_SQUARED))
{ {
// interpolate // interpolate
target_pos = new_pos; target_pos = new_pos;
target_rot = new_rot; target_rot = new_rot;
target_scale = new_scale; target_scale = new_scale;
}
else if (mVObjp->getAngularVelocity().isExactlyZero())
{
// snap to final position (only if no target omega is applied)
dist_squared = 0.0f;
if (getVOVolume() && !isRoot())
{ //child prim snapping to some position, needs a rebuild
gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
}
}
} }
else if (mVObjp->getAngularVelocity().isExactlyZero()) else
{ {
// snap to final position (only if no target omega is applied) dist_squared = dist_vec_squared(old_pos, target_pos);
dist_squared = 0.0f; dist_squared += (1.f - dot(old_rot, target_rot)) * 10.f;
if (getVOVolume() && !isRoot()) dist_squared += dist_vec_squared(old_scale, target_scale);
{ //child prim snapping to some position, needs a rebuild
gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
}
} }
} }
else
{
dist_squared = dist_vec_squared(old_pos, target_pos);
dist_squared += (1.f - dot(old_rot, target_rot)) * 10.f;
dist_squared += dist_vec_squared(old_scale, target_scale);
}
LLVector3 vec = mCurrentScale-target_scale; LLVector3 vec = mCurrentScale-target_scale;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment