diff options
author | Justin Clark-Casey (justincc) | 2014-09-02 23:35:03 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-09-02 23:39:52 +0100 |
commit | d582db6132ef7bea8b15e7a9f0dd64400d43b517 (patch) | |
tree | a277f69574ae09020245e4fa3a3f58cb59dceacf /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | As per the LL grid, if an avatar is sitting then return it's velocity relativ... (diff) | |
download | opensim-SC_OLD-d582db6132ef7bea8b15e7a9f0dd64400d43b517.zip opensim-SC_OLD-d582db6132ef7bea8b15e7a9f0dd64400d43b517.tar.gz opensim-SC_OLD-d582db6132ef7bea8b15e7a9f0dd64400d43b517.tar.bz2 opensim-SC_OLD-d582db6132ef7bea8b15e7a9f0dd64400d43b517.tar.xz |
Fix recent regression from 473c5594 where camera started to judder on moving vehicles.
Other parts of OpenSimulator are relying on SP.Velocity == 0 for vehicles.
So add and use SP.GetWorldVelocity() instead when we need vehicle velocity, along the same lines as existing SP.GetWorldRotation()
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index e0b7640..f2a636a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -608,8 +608,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
608 | } | 608 | } |
609 | 609 | ||
610 | /// <summary> | 610 | /// <summary> |
611 | /// Current velocity of the avatar. | 611 | /// Velocity of the avatar with respect to its local reference frame. |
612 | /// </summary> | 612 | /// </summary> |
613 | /// <remarks> | ||
614 | /// So when sat on a vehicle this will be 0. To get velocity with respect to the world use GetWorldVelocity() | ||
615 | /// </remarks> | ||
613 | public override Vector3 Velocity | 616 | public override Vector3 Velocity |
614 | { | 617 | { |
615 | get | 618 | get |
@@ -622,10 +625,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
622 | // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", | 625 | // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", |
623 | // m_velocity, Name, Scene.RegionInfo.RegionName); | 626 | // m_velocity, Name, Scene.RegionInfo.RegionName); |
624 | } | 627 | } |
625 | else if (ParentPart != null) | 628 | // else if (ParentPart != null) |
626 | { | 629 | // { |
627 | return ParentPart.ParentGroup.Velocity; | 630 | // return ParentPart.ParentGroup.Velocity; |
628 | } | 631 | // } |
629 | 632 | ||
630 | return m_velocity; | 633 | return m_velocity; |
631 | } | 634 | } |
@@ -749,25 +752,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
749 | } | 752 | } |
750 | 753 | ||
751 | /// <summary> | 754 | /// <summary> |
752 | /// Gets the world rotation of this presence. | 755 | /// Get rotation relative to the world. |
753 | /// </summary> | 756 | /// </summary> |
754 | /// <remarks> | ||
755 | /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not. | ||
756 | /// </remarks> | ||
757 | /// <returns></returns> | 757 | /// <returns></returns> |
758 | public Quaternion GetWorldRotation() | 758 | public Quaternion GetWorldRotation() |
759 | { | 759 | { |
760 | if (IsSatOnObject) | 760 | SceneObjectPart sitPart = ParentPart; |
761 | { | ||
762 | SceneObjectPart sitPart = ParentPart; | ||
763 | 761 | ||
764 | if (sitPart != null) | 762 | if (sitPart != null) |
765 | return sitPart.GetWorldRotation() * Rotation; | 763 | return sitPart.GetWorldRotation() * Rotation; |
766 | } | ||
767 | 764 | ||
768 | return Rotation; | 765 | return Rotation; |
769 | } | 766 | } |
770 | 767 | ||
768 | /// <summary> | ||
769 | /// Get velocity relative to the world. | ||
770 | /// </summary> | ||
771 | public Vector3 GetWorldVelocity() | ||
772 | { | ||
773 | SceneObjectPart sitPart = ParentPart; | ||
774 | |||
775 | if (sitPart != null) | ||
776 | return sitPart.ParentGroup.Velocity; | ||
777 | |||
778 | return Velocity; | ||
779 | } | ||
780 | |||
771 | public void AdjustKnownSeeds() | 781 | public void AdjustKnownSeeds() |
772 | { | 782 | { |
773 | Dictionary<ulong, string> seeds; | 783 | Dictionary<ulong, string> seeds; |