From 2ed1afd32b1d7573dec664d61538475523b10edc Mon Sep 17 00:00:00 2001 From: dahlia Date: Sat, 7 Feb 2015 14:17:37 -0800 Subject: [PATCH] llLookAt(): reduce and clamp strengh to reduce probability of overshoot --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ea0245ceb1..8d28915b80 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4910,10 +4910,13 @@ namespace OpenSim.Region.Framework.Scenes if (angle > Math.PI) angle = 2.0f * (float)Math.PI - angle; + // clamp strength to avoid overshoot + float strength = APIDStrength; + if (strength > 1.0) strength = 1.0f; + // set angular velocity to rotate to desired orientation // with velocity proportional to strength and angle - // the factor of 10 seems to make rotation speed closer to LL implementation - AngularVelocity = axis * angle * APIDStrength * (float)Math.PI * 10.0f; + AngularVelocity = axis * angle * strength * (float)Math.PI; // This ensures that we'll check this object on the next iteration ParentGroup.QueueForUpdateCheck();