diff options
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 193ef0d..c9a8832 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -226,11 +226,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | 226 | ||
227 | public Quaternion SpinOldOrientation = Quaternion.Identity; | 227 | public Quaternion SpinOldOrientation = Quaternion.Identity; |
228 | 228 | ||
229 | public Quaternion m_APIDTarget = Quaternion.Identity; | 229 | protected int m_APIDIterations = 0; |
230 | 230 | protected Quaternion m_APIDTarget = Quaternion.Identity; | |
231 | public float m_APIDDamp = 0; | 231 | protected float m_APIDDamp = 0; |
232 | 232 | protected float m_APIDStrength = 0; | |
233 | public float m_APIDStrength = 0; | ||
234 | 233 | ||
235 | /// <summary> | 234 | /// <summary> |
236 | /// This part's inventory | 235 | /// This part's inventory |
@@ -578,22 +577,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
578 | } | 577 | } |
579 | } | 578 | } |
580 | 579 | ||
581 | 580 | protected Quaternion APIDTarget | |
582 | public Quaternion APIDTarget | ||
583 | { | 581 | { |
584 | get { return m_APIDTarget; } | 582 | get { return m_APIDTarget; } |
585 | set { m_APIDTarget = value; } | 583 | set { m_APIDTarget = value; } |
586 | } | 584 | } |
587 | 585 | ||
588 | 586 | ||
589 | public float APIDDamp | 587 | protected float APIDDamp |
590 | { | 588 | { |
591 | get { return m_APIDDamp; } | 589 | get { return m_APIDDamp; } |
592 | set { m_APIDDamp = value; } | 590 | set { m_APIDDamp = value; } |
593 | } | 591 | } |
594 | 592 | ||
595 | 593 | ||
596 | public float APIDStrength | 594 | protected float APIDStrength |
597 | { | 595 | { |
598 | get { return m_APIDStrength; } | 596 | get { return m_APIDStrength; } |
599 | set { m_APIDStrength = value; } | 597 | set { m_APIDStrength = value; } |
@@ -2768,17 +2766,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
2768 | APIDDamp = damping; | 2766 | APIDDamp = damping; |
2769 | APIDStrength = strength; | 2767 | APIDStrength = strength; |
2770 | APIDTarget = target; | 2768 | APIDTarget = target; |
2769 | |||
2770 | if (APIDStrength <= 0) | ||
2771 | { | ||
2772 | m_log.WarnFormat("[SceneObjectPart] Invalid rotation strength {0}",APIDStrength); | ||
2773 | return; | ||
2774 | } | ||
2775 | |||
2776 | m_APIDIterations = 1 + (int)(Math.PI * APIDStrength); | ||
2771 | } | 2777 | } |
2778 | |||
2779 | // Necessary to get the lookat deltas applied | ||
2780 | ParentGroup.QueueForUpdateCheck(); | ||
2772 | } | 2781 | } |
2773 | 2782 | ||
2774 | public void startLookAt(Quaternion rot, float damp, float strength) | 2783 | public void StartLookAt(Quaternion target, float strength, float damping) |
2775 | { | 2784 | { |
2776 | APIDDamp = damp; | 2785 | RotLookAt(target,strength,damping); |
2777 | APIDStrength = strength; | ||
2778 | APIDTarget = rot; | ||
2779 | } | 2786 | } |
2780 | 2787 | ||
2781 | public void stopLookAt() | 2788 | public void StopLookAt() |
2782 | { | 2789 | { |
2783 | APIDTarget = Quaternion.Identity; | 2790 | APIDTarget = Quaternion.Identity; |
2784 | } | 2791 | } |
@@ -3468,13 +3475,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3468 | } | 3475 | } |
3469 | } | 3476 | } |
3470 | 3477 | ||
3471 | public void StopLookAt() | ||
3472 | { | ||
3473 | ParentGroup.stopLookAt(); | ||
3474 | |||
3475 | ParentGroup.ScheduleGroupForTerseUpdate(); | ||
3476 | } | ||
3477 | |||
3478 | /// <summary> | 3478 | /// <summary> |
3479 | /// Set the text displayed for this part. | 3479 | /// Set the text displayed for this part. |
3480 | /// </summary> | 3480 | /// </summary> |
@@ -4790,24 +4790,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
4790 | { | 4790 | { |
4791 | if (APIDTarget != Quaternion.Identity) | 4791 | if (APIDTarget != Quaternion.Identity) |
4792 | { | 4792 | { |
4793 | if (Single.IsNaN(APIDTarget.W) == true) | 4793 | if (m_APIDIterations <= 1) |
4794 | { | 4794 | { |
4795 | UpdateRotation(APIDTarget); | ||
4795 | APIDTarget = Quaternion.Identity; | 4796 | APIDTarget = Quaternion.Identity; |
4796 | return; | 4797 | return; |
4797 | } | 4798 | } |
4798 | Quaternion rot = RotationOffset; | 4799 | |
4799 | Quaternion dir = (rot - APIDTarget); | 4800 | Quaternion rot = Quaternion.Slerp(RotationOffset,APIDTarget,1.0f/(float)m_APIDIterations); |
4800 | float speed = ((APIDStrength / APIDDamp) * (float)(Math.PI / 180.0f)); | ||
4801 | if (dir.Z > speed) | ||
4802 | { | ||
4803 | rot.Z -= speed; | ||
4804 | } | ||
4805 | if (dir.Z < -speed) | ||
4806 | { | ||
4807 | rot.Z += speed; | ||
4808 | } | ||
4809 | rot.Normalize(); | ||
4810 | UpdateRotation(rot); | 4801 | UpdateRotation(rot); |
4802 | |||
4803 | m_APIDIterations--; | ||
4804 | |||
4805 | // This ensures that we'll check this object on the next iteration | ||
4806 | ParentGroup.QueueForUpdateCheck(); | ||
4811 | } | 4807 | } |
4812 | } | 4808 | } |
4813 | catch (Exception ex) | 4809 | catch (Exception ex) |