diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 |
2 files changed, 36 insertions, 6 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( |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index dd7ee24..47f8758 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10518,7 +10518,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10518 | ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); | 10518 | ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); |
10519 | break; | 10519 | break; |
10520 | case ScriptBaseClass.OBJECT_ROT: | 10520 | case ScriptBaseClass.OBJECT_ROT: |
10521 | ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); | 10521 | ret.Add(new LSL_Rotation(av.GetWorldRotation())); |
10522 | break; | 10522 | break; |
10523 | case ScriptBaseClass.OBJECT_VELOCITY: | 10523 | case ScriptBaseClass.OBJECT_VELOCITY: |
10524 | ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); | 10524 | ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); |