aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-03-14 21:23:48 +0000
committerJustin Clark-Casey (justincc)2013-03-14 21:23:48 +0000
commite9c394fb4ed56ffb931a0161b8c6fdc929b38058 (patch)
treec270d96a638974cdf6341006a9430c04922467ab /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentMerge branch 'master' of ssh://opensim/var/git/opensim (diff)
downloadopensim-SC_OLD-e9c394fb4ed56ffb931a0161b8c6fdc929b38058.zip
opensim-SC_OLD-e9c394fb4ed56ffb931a0161b8c6fdc929b38058.tar.gz
opensim-SC_OLD-e9c394fb4ed56ffb931a0161b8c6fdc929b38058.tar.bz2
opensim-SC_OLD-e9c394fb4ed56ffb931a0161b8c6fdc929b38058.tar.xz
Make llGetObjectDetails() return the correct world rotation for a sitting avatar
This addresses http://opensimulator.org/mantis/view.php?id=6567 This creates a ScenePresence.GetWorldRotation() with the same semantics as SOP.GetWorldRotation() SP.Rotation can't be used since it's relative to the sat upon prim if the avatar is sitting.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs40
1 files changed, 35 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a7c7539..82bb759 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -559,16 +559,28 @@ namespace OpenSim.Region.Framework.Scenes
559 559
560 private Quaternion m_bodyRot = Quaternion.Identity; 560 private Quaternion m_bodyRot = Quaternion.Identity;
561 561
562 /// <summary>
563 /// The rotation of the avatar.
564 /// </summary>
565 /// <remarks>
566 /// If the avatar is not sitting, this is with respect to the world
567 /// If the avatar is sitting, this is a with respect to the part that it's sitting upon (a local rotation).
568 /// If you always want the world rotation, use GetWorldRotation()
569 /// </remarks>
562 public Quaternion Rotation 570 public Quaternion Rotation
563 { 571 {
564 get { return m_bodyRot; } 572 get
573 {
574 return m_bodyRot;
575 }
576
565 set 577 set
566 { 578 {
567 m_bodyRot = value; 579 m_bodyRot = value;
580
568 if (PhysicsActor != null) 581 if (PhysicsActor != null)
569 {
570 PhysicsActor.Orientation = m_bodyRot; 582 PhysicsActor.Orientation = m_bodyRot;
571 } 583
572// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot); 584// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot);
573 } 585 }
574 } 586 }
@@ -608,6 +620,26 @@ namespace OpenSim.Region.Framework.Scenes
608 set { m_health = value; } 620 set { m_health = value; }
609 } 621 }
610 622
623 /// <summary>
624 /// Gets the world rotation of this presence.
625 /// </summary>
626 /// <remarks>
627 /// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not.
628 /// </remarks>
629 /// <returns></returns>
630 public Quaternion GetWorldRotation()
631 {
632 if (IsSatOnObject)
633 {
634 SceneObjectPart sitPart = ParentPart;
635
636 if (sitPart != null)
637 return sitPart.GetWorldRotation() * Rotation;
638 }
639
640 return Rotation;
641 }
642
611 public void AdjustKnownSeeds() 643 public void AdjustKnownSeeds()
612 { 644 {
613 Dictionary<ulong, string> seeds; 645 Dictionary<ulong, string> seeds;
@@ -709,8 +741,6 @@ namespace OpenSim.Region.Framework.Scenes
709 741
710 #endregion 742 #endregion
711 743
712
713
714 #region Constructor(s) 744 #region Constructor(s)
715 745
716 public ScenePresence( 746 public ScenePresence(