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.user_profiles
parent
9fad90a914
commit
e9c394fb4e
|
@ -559,16 +559,28 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
private Quaternion m_bodyRot = Quaternion.Identity;
|
||||
|
||||
/// <summary>
|
||||
/// The rotation of the avatar.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If the avatar is not sitting, this is with respect to the world
|
||||
/// If the avatar is sitting, this is a with respect to the part that it's sitting upon (a local rotation).
|
||||
/// If you always want the world rotation, use GetWorldRotation()
|
||||
/// </remarks>
|
||||
public Quaternion Rotation
|
||||
{
|
||||
get { return m_bodyRot; }
|
||||
get
|
||||
{
|
||||
return m_bodyRot;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
m_bodyRot = value;
|
||||
|
||||
if (PhysicsActor != null)
|
||||
{
|
||||
PhysicsActor.Orientation = m_bodyRot;
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, m_bodyRot);
|
||||
}
|
||||
}
|
||||
|
@ -608,6 +620,26 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
set { m_health = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the world rotation of this presence.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Unlike Rotation, this returns the world rotation no matter whether the avatar is sitting on a prim or not.
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
public Quaternion GetWorldRotation()
|
||||
{
|
||||
if (IsSatOnObject)
|
||||
{
|
||||
SceneObjectPart sitPart = ParentPart;
|
||||
|
||||
if (sitPart != null)
|
||||
return sitPart.GetWorldRotation() * Rotation;
|
||||
}
|
||||
|
||||
return Rotation;
|
||||
}
|
||||
|
||||
public void AdjustKnownSeeds()
|
||||
{
|
||||
Dictionary<ulong, string> seeds;
|
||||
|
@ -709,8 +741,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region Constructor(s)
|
||||
|
||||
public ScenePresence(
|
||||
|
|
|
@ -10518,7 +10518,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_ROT:
|
||||
ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W));
|
||||
ret.Add(new LSL_Rotation(av.GetWorldRotation()));
|
||||
break;
|
||||
case ScriptBaseClass.OBJECT_VELOCITY:
|
||||
ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z));
|
||||
|
|
Loading…
Reference in New Issue