diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2017-08-25 16:43:19 +0300 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2017-08-25 16:43:19 +0300 |
commit | c8a932fa8a09a925c0cb3a0bc25e90456bb56d68 (patch) | |
tree | 30683ac1f03875578d6826ba6ca130c6b4f391e3 /indra/newview/llphysicsmotion.cpp | |
parent | a27466ca07e5568442053e02ac9e76297ee74787 (diff) |
MAINT-989 Fixed Avatar Physics Vary Extremely With Different Framerates
Diffstat (limited to 'indra/newview/llphysicsmotion.cpp')
-rw-r--r-- | indra/newview/llphysicsmotion.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index ea10d03264..65b57a2790 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -44,7 +44,7 @@ typedef std::map<std::string, std::string> controller_map_t; typedef std::map<std::string, F32> default_controller_map_t; #define MIN_REQUIRED_PIXEL_AREA_AVATAR_PHYSICS_MOTION 0.f -#define TIME_ITERATION_STEP 0.1f +#define TIME_ITERATION_STEP 0.033f // roughtly 30 fps inline F64 llsgn(const F64 a) { @@ -493,8 +493,8 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) const F32 time_delta = time - mLastTime; - // Don't update too frequently, to avoid precision errors from small time slices. - if (time_delta <= .01) + // Don't update too frequently (below 0.01), to avoid precision errors from small time slices. + if (time_delta <= TIME_ITERATION_STEP) { return FALSE; } @@ -561,7 +561,10 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) F32 time_iteration_step = TIME_ITERATION_STEP; if (time_iteration + TIME_ITERATION_STEP > time_delta) { - time_iteration_step = time_delta-time_iteration; + time_iteration_step = time_delta - time_iteration; + // Leave the rest for next update. + mLastTime = time - time_iteration_step; + break; } // mPositon_local should be in normalized 0,1 range already. Just making sure... @@ -716,7 +719,6 @@ BOOL LLPhysicsMotion::onUpdate(F32 time) mAccelerationJoint_local = acceleration_joint_local; mPosition_local = position_new_local; } - mLastTime = time; mPosition_world = joint->getWorldPosition(); mVelocityJoint_local = velocity_joint_local; |