aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2009-12-10 18:17:29 +0000
committerMelanie2009-12-10 18:17:29 +0000
commit59ca92b10b31c589312cb74e7554adf817bad466 (patch)
tree5630cc3b75d6ecf4bf0b5c4ad200f9997ea72a8b
parentMerge branch 'careminster' of kitto@tor.k-grid.com:/home/kitto/opensim into c... (diff)
parentCorrect AbsolutePosition calculation (diff)
downloadopensim-SC_OLD-59ca92b10b31c589312cb74e7554adf817bad466.zip
opensim-SC_OLD-59ca92b10b31c589312cb74e7554adf817bad466.tar.gz
opensim-SC_OLD-59ca92b10b31c589312cb74e7554adf817bad466.tar.bz2
opensim-SC_OLD-59ca92b10b31c589312cb74e7554adf817bad466.tar.xz
Merge branch 'tests' of kitto@tor.k-grid.com:/home/kitto/opensim into careminster
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs8
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs28
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs254
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp2
5 files changed, 172 insertions, 129 deletions
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 0d4215b..f5be1e6 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,9 +29,8 @@ namespace OpenSim
29{ 29{
30 public class VersionInfo 30 public class VersionInfo
31 { 31 {
32 private const string VERSION_NUMBER = "0.6.9-CM"; 32 private const string VERSION_NUMBER = "112609s";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.BetaM7;
34
35 public enum Flavour 34 public enum Flavour
36 { 35 {
37 Unknown, 36 Unknown,
@@ -39,7 +38,8 @@ namespace OpenSim
39 RC1, 38 RC1,
40 RC2, 39 RC2,
41 Release, 40 Release,
42 Post_Fixes 41 Post_Fixes,
42 BetaM7
43 } 43 }
44 44
45 public static string Version 45 public static string Version
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
index 710e3ca..39e2413 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs
@@ -331,12 +331,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
331 { 331 {
332 //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); 332 //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called");
333 333
334 m_log.Debug("---------------------------"); 334/* m_log.Debug("---------------------------");
335 m_log.Debug(" >> uri=" + request["uri"]); 335 m_log.Debug(" >> uri=" + request["uri"]);
336 m_log.Debug(" >> content-type=" + request["content-type"]); 336 m_log.Debug(" >> content-type=" + request["content-type"]);
337 m_log.Debug(" >> http-method=" + request["http-method"]); 337 m_log.Debug(" >> http-method=" + request["http-method"]);
338 m_log.Debug("---------------------------\n"); 338 m_log.Debug("---------------------------\n"); */
339
340 Hashtable responsedata = new Hashtable(); 339 Hashtable responsedata = new Hashtable();
341 responsedata["content_type"] = "text/html"; 340 responsedata["content_type"] = "text/html";
342 responsedata["keepalive"] = false; 341 responsedata["keepalive"] = false;
@@ -576,11 +575,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
576 { 575 {
577 m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called"); 576 m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called");
578 577
579 m_log.Debug("---------------------------"); 578 /* m_log.Debug("---------------------------");
580 m_log.Debug(" >> uri=" + request["uri"]); 579 m_log.Debug(" >> uri=" + request["uri"]);
581 m_log.Debug(" >> content-type=" + request["content-type"]); 580 m_log.Debug(" >> content-type=" + request["content-type"]);
582 m_log.Debug(" >> http-method=" + request["http-method"]); 581 m_log.Debug(" >> http-method=" + request["http-method"]);
583 m_log.Debug("---------------------------\n"); 582 m_log.Debug("---------------------------\n"); */
584 583
585 Hashtable responsedata = new Hashtable(); 584 Hashtable responsedata = new Hashtable();
586 responsedata["content_type"] = "text/html"; 585 responsedata["content_type"] = "text/html";
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 19e3023..a23c11e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -212,6 +212,7 @@ namespace OpenSim.Region.Framework.Scenes
212 private Quaternion m_sitTargetOrientation = Quaternion.Identity; 212 private Quaternion m_sitTargetOrientation = Quaternion.Identity;
213 private Vector3 m_sitTargetPosition; 213 private Vector3 m_sitTargetPosition;
214 private string m_sitAnimation = "SIT"; 214 private string m_sitAnimation = "SIT";
215 private bool m_occupied; // KF if any av is sitting on this prim
215 private string m_text = String.Empty; 216 private string m_text = String.Empty;
216 private string m_touchName = String.Empty; 217 private string m_touchName = String.Empty;
217 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5); 218 private readonly UndoStack<UndoState> m_undo = new UndoStack<UndoState>(5);
@@ -512,9 +513,16 @@ namespace OpenSim.Region.Framework.Scenes
512 { 513 {
513 // If this is a linkset, we don't want the physics engine mucking up our group position here. 514 // If this is a linkset, we don't want the physics engine mucking up our group position here.
514 PhysicsActor actor = PhysActor; 515 PhysicsActor actor = PhysActor;
515 if (actor != null && _parentID == 0) 516 if (actor != null)
516 { 517 {
517 m_groupPosition = actor.Position; 518 if (_parentID == 0)
519 {
520 m_groupPosition = actor.Position;
521 }
522 else
523 {
524 m_groupPosition = ParentGroup.AbsolutePosition; // KF+Casper Update Child prims too!
525 }
518 } 526 }
519 527
520 if (IsAttachment) 528 if (IsAttachment)
@@ -841,7 +849,8 @@ namespace OpenSim.Region.Framework.Scenes
841 if (IsAttachment) 849 if (IsAttachment)
842 return GroupPosition; 850 return GroupPosition;
843 851
844 return m_offsetPosition + m_groupPosition; } 852// return m_offsetPosition + m_groupPosition; }
853 return m_groupPosition + (m_offsetPosition * ParentGroup.RootPart.RotationOffset) ; } //KF: Rotation was ignored!
845 } 854 }
846 855
847 public SceneObjectGroup ParentGroup 856 public SceneObjectGroup ParentGroup
@@ -993,6 +1002,13 @@ namespace OpenSim.Region.Framework.Scenes
993 get { return _flags; } 1002 get { return _flags; }
994 set { _flags = value; } 1003 set { _flags = value; }
995 } 1004 }
1005
1006 [XmlIgnore]
1007 public bool IsOccupied // KF If an av is sittingon this prim
1008 {
1009 get { return m_occupied; }
1010 set { m_occupied = value; }
1011 }
996 1012
997 [XmlIgnore] 1013 [XmlIgnore]
998 public UUID SitTargetAvatar 1014 public UUID SitTargetAvatar
@@ -1735,9 +1751,13 @@ namespace OpenSim.Region.Framework.Scenes
1735 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 1751 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1736 1752
1737 Vector3 axPos = OffsetPosition; 1753 Vector3 axPos = OffsetPosition;
1738
1739 axPos *= parentRot; 1754 axPos *= parentRot;
1740 Vector3 translationOffsetPosition = axPos; 1755 Vector3 translationOffsetPosition = axPos;
1756
1757 int tx = (int)GroupPosition.X;
1758 int ty = (int)GroupPosition.Y;
1759 int tz = (int)GroupPosition.Z;
1760
1741 return GroupPosition + translationOffsetPosition; 1761 return GroupPosition + translationOffsetPosition;
1742 } 1762 }
1743 1763
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f6bcb59..fbc4ed5 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -197,6 +197,7 @@ namespace OpenSim.Region.Framework.Scenes
197 private bool m_autopilotMoving; 197 private bool m_autopilotMoving;
198 private Vector3 m_autoPilotTarget; 198 private Vector3 m_autoPilotTarget;
199 private bool m_sitAtAutoTarget; 199 private bool m_sitAtAutoTarget;
200 private Vector3 m_initialSitTarget; //KF: First estimate of where to sit
200 201
201 private string m_nextSitAnimation = String.Empty; 202 private string m_nextSitAnimation = String.Empty;
202 203
@@ -1525,7 +1526,6 @@ namespace OpenSim.Region.Framework.Scenes
1525 m_sitAtAutoTarget = false; 1526 m_sitAtAutoTarget = false;
1526 PrimitiveBaseShape proxy = PrimitiveBaseShape.Default; 1527 PrimitiveBaseShape proxy = PrimitiveBaseShape.Default;
1527 //proxy.PCode = (byte)PCode.ParticleSystem; 1528 //proxy.PCode = (byte)PCode.ParticleSystem;
1528
1529 proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy); 1529 proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy);
1530 proxyObjectGroup.AttachToScene(m_scene); 1530 proxyObjectGroup.AttachToScene(m_scene);
1531 1531
@@ -1567,7 +1567,7 @@ namespace OpenSim.Region.Framework.Scenes
1567 } 1567 }
1568 m_moveToPositionInProgress = true; 1568 m_moveToPositionInProgress = true;
1569 m_moveToPositionTarget = new Vector3(locx, locy, locz); 1569 m_moveToPositionTarget = new Vector3(locx, locy, locz);
1570 } 1570 }
1571 catch (Exception ex) 1571 catch (Exception ex)
1572 { 1572 {
1573 //Why did I get this error? 1573 //Why did I get this error?
@@ -1643,20 +1643,24 @@ namespace OpenSim.Region.Framework.Scenes
1643 // Reset sit target. 1643 // Reset sit target.
1644 if (part.GetAvatarOnSitTarget() == UUID) 1644 if (part.GetAvatarOnSitTarget() == UUID)
1645 part.SetAvatarOnSitTarget(UUID.Zero); 1645 part.SetAvatarOnSitTarget(UUID.Zero);
1646
1647 m_parentPosition = part.GetWorldPosition(); 1646 m_parentPosition = part.GetWorldPosition();
1648 ControllingClient.SendClearFollowCamProperties(part.ParentUUID); 1647 ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
1649 } 1648 }
1649 // part.GetWorldRotation() is the rotation of the object being sat on
1650 // Rotation is the sittiing Av's rotation
1651
1652 Quaternion wr = Quaternion.Inverse(Quaternion.Inverse(Rotation) * Quaternion.Inverse(part.GetWorldRotation())); // world or. of the av
1653 Vector3 so = new Vector3(1.0f, 0f, 0f) * wr; // 1M infront of av
1654 Vector3 wso = so + part.GetWorldPosition() + ( m_pos * part.GetWorldRotation()); // + av sit offset!
1650 1655
1651 if (m_physicsActor == null) 1656 if (m_physicsActor == null)
1652 { 1657 {
1653 AddToPhysicalScene(false); 1658 AddToPhysicalScene(false);
1654 } 1659 }
1655 m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); 1660 AbsolutePosition = wso; //KF: Fix stand up.
1656 m_parentPosition = Vector3.Zero; 1661 m_parentPosition = Vector3.Zero;
1657//Console.WriteLine("Stand Pos {0}", m_pos); 1662 m_parentID = 0;
1658 1663 part.IsOccupied = false;
1659 m_parentID = 0;
1660 SendFullUpdateToAllClients(); 1664 SendFullUpdateToAllClients();
1661 m_requestedSitTargetID = 0; 1665 m_requestedSitTargetID = 0;
1662 if ((m_physicsActor != null) && (m_avHeight > 0)) 1666 if ((m_physicsActor != null) && (m_avHeight > 0))
@@ -1695,13 +1699,9 @@ namespace OpenSim.Region.Framework.Scenes
1695 Vector3 avSitOffSet = part.SitTargetPosition; 1699 Vector3 avSitOffSet = part.SitTargetPosition;
1696 Quaternion avSitOrientation = part.SitTargetOrientation; 1700 Quaternion avSitOrientation = part.SitTargetOrientation;
1697 UUID avOnTargetAlready = part.GetAvatarOnSitTarget(); 1701 UUID avOnTargetAlready = part.GetAvatarOnSitTarget();
1698 1702 bool SitTargetOccupied = (avOnTargetAlready != UUID.Zero);
1699 bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); 1703 bool SitTargetisSet = (Vector3.Zero != avSitOffSet); //NB Latest SL Spec shows Sit Rotation setting is ignored.
1700 bool SitTargetisSet = 1704 if (SitTargetisSet && !SitTargetOccupied)
1701 (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 1f &&
1702 avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f));
1703 // this test is probably failing
1704 if (SitTargetisSet && SitTargetUnOccupied)
1705 { 1705 {
1706 //switch the target to this prim 1706 //switch the target to this prim
1707 return part; 1707 return part;
@@ -1715,7 +1715,7 @@ namespace OpenSim.Region.Framework.Scenes
1715 private void SendSitResponse(IClientAPI remoteClient, UUID targetID, Vector3 offset) 1715 private void SendSitResponse(IClientAPI remoteClient, UUID targetID, Vector3 offset)
1716 { 1716 {
1717 bool autopilot = true; 1717 bool autopilot = true;
1718 Vector3 pos = new Vector3(); 1718 Vector3 autopilotTarget = new Vector3();
1719 Quaternion sitOrientation = Quaternion.Identity; 1719 Quaternion sitOrientation = Quaternion.Identity;
1720 Vector3 cameraEyeOffset = Vector3.Zero; 1720 Vector3 cameraEyeOffset = Vector3.Zero;
1721 Vector3 cameraAtOffset = Vector3.Zero; 1721 Vector3 cameraAtOffset = Vector3.Zero;
@@ -1723,101 +1723,104 @@ namespace OpenSim.Region.Framework.Scenes
1723 1723
1724 //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); 1724 //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
1725 SceneObjectPart part = FindNextAvailableSitTarget(targetID); 1725 SceneObjectPart part = FindNextAvailableSitTarget(targetID);
1726 if (part != null) 1726 if (part == null) return;
1727 { 1727
1728 // TODO: determine position to sit at based on scene geometry; don't trust offset from client 1728 // TODO: determine position to sit at based on scene geometry; don't trust offset from client
1729 // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it 1729 // see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
1730 1730
1731 // part is the prim to sit on 1731 // part is the prim to sit on
1732 // offset is the vector distance from that prim center to the click-spot 1732 // offset is the world-ref vector distance from that prim center to the click-spot
1733 // UUID is the UUID of the Avatar doing the clicking 1733 // UUID is the UUID of the Avatar doing the clicking
1734
1735 m_avInitialPos = AbsolutePosition; // saved to calculate unscripted sit rotation
1736 1734
1737 // Is a sit target available? 1735 m_avInitialPos = AbsolutePosition; // saved to calculate unscripted sit rotation
1738 Vector3 avSitOffSet = part.SitTargetPosition; 1736
1739 Quaternion avSitOrientation = part.SitTargetOrientation; 1737 // Is a sit target available?
1740 UUID avOnTargetAlready = part.GetAvatarOnSitTarget(); 1738 Vector3 avSitOffSet = part.SitTargetPosition;
1741 1739 Quaternion avSitOrientation = part.SitTargetOrientation;
1742 bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); 1740
1743 bool SitTargetisSet = 1741 bool SitTargetisSet = (Vector3.Zero != avSitOffSet); //NB Latest SL Spec shows Sit Rotation setting is ignored.
1744 (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && 1742 Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
1745 ( 1743
1746 avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 1f // Valid Zero Rotation quaternion 1744//Console.WriteLine("SendSitResponse offset=" + offset + " Occup=" + part.IsOccupied + " TargSet=" + SitTargetisSet);
1747 || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point 1745 // Sit analysis rewritten by KF 091125
1748 || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion 1746 if (SitTargetisSet) // scipted sit
1749 ) 1747 {
1750 )); 1748 if (!part.IsOccupied)
1751 1749 {
1752//Console.WriteLine("SendSitResponse offset=" + offset + " UnOccup=" + SitTargetUnOccupied + 1750//Console.WriteLine("Scripted, unoccupied");
1753// " TargSet=" + SitTargetisSet); 1751 part.SetAvatarOnSitTarget(UUID); // set that Av will be on it
1754 // Sit analysis rewritten by KF 091125 1752 offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one
1755 if (SitTargetisSet) // scipted sit 1753 sitOrientation = avSitOrientation; // Change rotatione to the scripted one
1756 { 1754 autopilot = false; // Jump direct to scripted llSitPos()
1757 if (SitTargetUnOccupied)
1758 {
1759 part.SetAvatarOnSitTarget(UUID); // set that Av will be on it
1760 offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one
1761 sitOrientation = avSitOrientation; // Change rotatione to the scripted one
1762 autopilot = false; // Jump direct to scripted llSitPos()
1763 }
1764 else return;
1765 } 1755 }
1766 else // Not Scripted 1756 else
1767 { 1757 {
1768 if ( (Math.Abs(offset.X) > 0.5f) || (Math.Abs(offset.Y) > 0.5f) ) // large prim 1758//Console.WriteLine("Scripted, occupied");
1769 { 1759 return;
1770 Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation()); 1760 }
1771 m_avUnscriptedSitPos = offset * partIRot; // sit where clicked 1761 }
1772 pos = part.AbsolutePosition + (offset * partIRot); 1762 else // Not Scripted
1773 } 1763 {
1774 else // small prim 1764 if ( (Math.Abs(offset.X) > 0.5f) || (Math.Abs(offset.Y) > 0.5f) )
1775 { 1765 {
1776 if (SitTargetUnOccupied) 1766 // large prim & offset, ignore if other Avs sitting
1777 { 1767// offset.Z -= 0.05f;
1778 m_avUnscriptedSitPos = Vector3.Zero; // Sit on unoccupied small prim center 1768 m_avUnscriptedSitPos = offset * partIRot; // (non-zero) sit where clicked
1779 pos = part.AbsolutePosition; 1769 autopilotTarget = part.AbsolutePosition + offset; // World location of clicked point
1780 } 1770
1781 else return; // occupied small 1771//Console.WriteLine(" offset ={0}", offset);
1782 } // end large/small 1772//Console.WriteLine(" UnscriptedSitPos={0}", m_avUnscriptedSitPos);
1783 } // end Scripted/not 1773//Console.WriteLine(" autopilotTarget={0}", autopilotTarget);
1784 1774
1785 if (m_physicsActor != null) 1775 }
1786 { 1776 else // small offset
1787 // If we're not using the client autopilot, we're immediately warping the avatar to the location 1777 {
1788 // We can remove the physicsActor until they stand up. 1778//Console.WriteLine("Small offset");
1789 m_sitAvatarHeight = m_physicsActor.Size.Z; 1779 if (!part.IsOccupied)
1790 1780 {
1791 if (autopilot) 1781 m_avUnscriptedSitPos = Vector3.Zero; // Zero = Sit on prim center
1792 { // its not a scripted sit 1782 autopilotTarget = part.AbsolutePosition;
1793 if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5) 1783 }
1794 { 1784 else return; // occupied small
1795 autopilot = false; // close enough 1785 } // end large/small
1786 } // end Scripted/not
1787 cameraAtOffset = part.GetCameraAtOffset();
1788 cameraEyeOffset = part.GetCameraEyeOffset();
1789 forceMouselook = part.GetForceMouselook();
1796 1790
1797 RemoveFromPhysicalScene(); 1791 if (m_physicsActor != null)
1798 AbsolutePosition = pos + new Vector3(0.0f, 0.0f, (m_sitAvatarHeight / 2.0f)); // Warp av to Prim 1792 {
1799 } // else the autopilot will get us close 1793 // If we're not using the client autopilot, we're immediately warping the avatar to the location
1800 } 1794 // We can remove the physicsActor until they stand up.
1801 else 1795 m_sitAvatarHeight = m_physicsActor.Size.Z;
1802 { // its a scripted sit 1796 if (autopilot)
1797 { // its not a scripted sit
1798// if (Util.GetDistanceTo(AbsolutePosition, autopilotTarget) < 4.5)
1799 if( (Math.Abs(AbsolutePosition.X - autopilotTarget.X) < 2.0f) && (Math.Abs(AbsolutePosition.Y - autopilotTarget.Y) < 2.0f) )
1800 {
1801 autopilot = false; // close enough
1803 RemoveFromPhysicalScene(); 1802 RemoveFromPhysicalScene();
1804 } 1803 AbsolutePosition = autopilotTarget + new Vector3(0.0f, 0.0f, (m_sitAvatarHeight / 2.0f)); // Warp av to over sit target
1804 } // else the autopilot will get us close
1805 }
1806 else
1807 { // its a scripted sit
1808 RemoveFromPhysicalScene();
1805 } 1809 }
1806
1807 cameraAtOffset = part.GetCameraAtOffset();
1808 cameraEyeOffset = part.GetCameraEyeOffset();
1809 forceMouselook = part.GetForceMouselook();
1810 } 1810 }
1811 else return; // physactor is null!
1811 1812
1812 ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); 1813 Vector3 offsetr = offset * partIRot;
1813 m_requestedSitTargetUUID = targetID; 1814 ControllingClient.SendSitResponse(part.UUID, offsetr, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook);
1815 m_requestedSitTargetUUID = part.UUID; //KF: Correct autopilot target
1814 // This calls HandleAgentSit twice, once from here, and the client calls 1816 // This calls HandleAgentSit twice, once from here, and the client calls
1815 // HandleAgentSit itself after it gets to the location 1817 // HandleAgentSit itself after it gets to the location
1816 // It doesn't get to the location until we've moved them there though 1818 // It doesn't get to the location until we've moved them there though
1817 // which happens in HandleAgentSit :P 1819 // which happens in HandleAgentSit :P
1818 m_autopilotMoving = autopilot; 1820 m_autopilotMoving = autopilot;
1819 m_autoPilotTarget = pos; 1821 m_autoPilotTarget = autopilotTarget;
1820 m_sitAtAutoTarget = autopilot; 1822 m_sitAtAutoTarget = autopilot;
1823 m_initialSitTarget = autopilotTarget;
1821 if (!autopilot) 1824 if (!autopilot)
1822 HandleAgentSit(remoteClient, UUID); 1825 HandleAgentSit(remoteClient, UUID);
1823 } 1826 }
@@ -1913,6 +1916,7 @@ namespace OpenSim.Region.Framework.Scenes
1913 { 1916 {
1914 if (part.GetAvatarOnSitTarget() == UUID) 1917 if (part.GetAvatarOnSitTarget() == UUID)
1915 { 1918 {
1919//Console.WriteLine("Scripted Sit");
1916 // Scripted sit 1920 // Scripted sit
1917 Vector3 sitTargetPos = part.SitTargetPosition; 1921 Vector3 sitTargetPos = part.SitTargetPosition;
1918 Quaternion sitTargetOrient = part.SitTargetOrientation; 1922 Quaternion sitTargetOrient = part.SitTargetOrientation;
@@ -1920,42 +1924,44 @@ namespace OpenSim.Region.Framework.Scenes
1920 m_pos += SIT_TARGET_ADJUSTMENT; 1924 m_pos += SIT_TARGET_ADJUSTMENT;
1921 m_bodyRot = sitTargetOrient; 1925 m_bodyRot = sitTargetOrient;
1922 m_parentPosition = part.AbsolutePosition; 1926 m_parentPosition = part.AbsolutePosition;
1927 part.IsOccupied = true;
1923 } 1928 }
1924 else 1929 else
1925 { 1930 {
1931//Console.WriteLine("NON Scripted Sit");
1932 // if m_avUnscriptedSitPos is zero then Av sits above center
1933 // Else Av sits at m_avUnscriptedSitPos
1934
1926 // Non-scripted sit by Kitto Flora 21Nov09 1935 // Non-scripted sit by Kitto Flora 21Nov09
1927 // Calculate angle of line from prim to Av 1936 // Calculate angle of line from prim to Av
1937 Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
1928 Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos; 1938 Vector3 sitTargetPos= part.AbsolutePosition + m_avUnscriptedSitPos;
1929 float y_diff = (m_avInitialPos.Y - sitTargetPos.Y); 1939 float y_diff = (m_avInitialPos.Y - sitTargetPos.Y);
1930 float x_diff = ( m_avInitialPos.X - sitTargetPos.X); 1940 float x_diff = ( m_avInitialPos.X - sitTargetPos.X);
1931 if(Math.Abs(x_diff) < 0.001f) x_diff = 0.001f; // avoid div by 0 1941 if(Math.Abs(x_diff) < 0.001f) x_diff = 0.001f; // avoid div by 0
1932 if(Math.Abs(y_diff) < 0.001f) y_diff = 0.001f; // avoid pol flip at 0 1942 if(Math.Abs(y_diff) < 0.001f) y_diff = 0.001f; // avoid pol flip at 0
1933 float sit_angle = (float)Math.Atan2( (double)y_diff, (double)x_diff); 1943 float sit_angle = (float)Math.Atan2( (double)y_diff, (double)x_diff);
1934 Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
1935 // NOTE: when sitting m_ pos and m_bodyRot are *relative* to the prim location/rotation, not 'World'. 1944 // NOTE: when sitting m_ pos and m_bodyRot are *relative* to the prim location/rotation, not 'World'.
1936 // Av sits at world euler <0,0, z>, translated by part rotation 1945 // Av sits at world euler <0,0, z>, translated by part rotation
1937 m_bodyRot = partIRot * Quaternion.CreateFromEulers(0f, 0f, sit_angle); // sit at 0,0,inv-click 1946 m_bodyRot = partIRot * Quaternion.CreateFromEulers(0f, 0f, sit_angle); // sit at 0,0,inv-click
1947
1938 m_parentPosition = part.AbsolutePosition; 1948 m_parentPosition = part.AbsolutePosition;
1939 if(m_avUnscriptedSitPos != Vector3.Zero) 1949 part.IsOccupied = true;
1940 { // sit where clicked on big prim 1950 m_pos = new Vector3(0f, 0f, 0.05f) + // corrections to get Sit Animation
1941 m_pos = m_avUnscriptedSitPos + (new Vector3(0.0f, 0f, 0.625f) * partIRot); 1951 (new Vector3(0.0f, 0f, 0.61f) * partIRot) + // located on center
1942 } 1952 (new Vector3(0.34f, 0f, 0.0f) * m_bodyRot) +
1943 else 1953 m_avUnscriptedSitPos; // adds click offset, if any
1944 { // sit at center of small prim 1954 //Set up raytrace to find top surface of prim
1945 m_pos = new Vector3(0f, 0f, 0.05f) + 1955 Vector3 size = part.Scale;
1946 (new Vector3(0.0f, 0f, 0.625f) * partIRot) + 1956 float mag = 0.1f + (float)Math.Sqrt((size.X * size.X) + (size.Y * size.Y) + (size.Z * size.Z));
1947 (new Vector3(0.25f, 0f, 0.0f) * m_bodyRot); 1957 Vector3 start = part.AbsolutePosition + new Vector3(0f, 0f, mag);
1948 //Set up raytrace to find top surface of prim 1958 Vector3 down = new Vector3(0f, 0f, -1f);
1949 Vector3 size = part.Scale; 1959//Console.WriteLine("st={0} do={1} ma={2}", start, down, mag);
1950 float mag = 0.1f + (float)Math.Sqrt((size.X * size.X) + (size.Y * size.Y) + (size.Z * size.Z)); 1960 m_scene.PhysicsScene.RaycastWorld(
1951 Vector3 start = part.AbsolutePosition + new Vector3(0f, 0f, mag);
1952 Vector3 down = new Vector3(0f, 0f, -1f);
1953 m_scene.PhysicsScene.RaycastWorld(
1954 start, // Vector3 position, 1961 start, // Vector3 position,
1955 down, // Vector3 direction, 1962 down, // Vector3 direction,
1956 mag, // float length, 1963 mag, // float length,
1957 SitAltitudeCallback); // retMethod 1964 SitAltitudeCallback); // retMethod
1958 } // end small/big
1959 } // end scripted/not 1965 } // end scripted/not
1960 } 1966 }
1961 else // no Av 1967 else // no Av
@@ -1974,17 +1980,22 @@ namespace OpenSim.Region.Framework.Scenes
1974 1980
1975 public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal) 1981 public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal)
1976 { 1982 {
1983 // KF: 091202 There appears to be a bug in Prim Edit Size - the process sometimes make a prim that RayTrace no longer
1984 // sees. Take/re-rez, or sim restart corrects the condition. Result of bug is incorrect sit height.
1977 if(hitYN) 1985 if(hitYN)
1978 { 1986 {
1979 // m_pos = Av offset from prim center to make look like on center 1987 // m_pos = Av offset from prim center to make look like on center
1980 // m_parentPosition = Actual center pos of prim 1988 // m_parentPosition = Actual center pos of prim
1981 // collisionPoint = spot on prim where we want to sit 1989 // collisionPoint = spot on prim where we want to sit
1990 // collisionPoint.Z = global sit surface height
1982 SceneObjectPart part = m_scene.GetSceneObjectPart(localid); 1991 SceneObjectPart part = m_scene.GetSceneObjectPart(localid);
1983 Vector3 offset = (collisionPoint - m_parentPosition) * Quaternion.Inverse(part.RotationOffset); 1992 Quaternion partIRot = Quaternion.Inverse(part.GetWorldRotation());
1993 float offZ = collisionPoint.Z - m_initialSitTarget.Z;
1994 Vector3 offset = new Vector3(0.0f, 0.0f, offZ) * partIRot; // Altitude correction
1995//Console.WriteLine("sitPoint={0}, offset={1}", sitPoint, offset);
1984 m_pos += offset; 1996 m_pos += offset;
1985// Console.WriteLine("m_pos={0}, offset={1} newsit={2}", m_pos, offset, newsit);
1986 } 1997 }
1987 } 1998 } // End SitAltitudeCallback KF.
1988 1999
1989 /// <summary> 2000 /// <summary>
1990 /// Event handler for the 'Always run' setting on the client 2001 /// Event handler for the 'Always run' setting on the client
@@ -3735,5 +3746,16 @@ namespace OpenSim.Region.Framework.Scenes
3735 m_reprioritization_called = false; 3746 m_reprioritization_called = false;
3736 } 3747 }
3737 } 3748 }
3749
3750 private Vector3 Quat2Euler(Quaternion rot){
3751 float x = Utils.RAD_TO_DEG * (float)Math.Atan2((double)((2.0f * rot.X * rot.W) - (2.0f * rot.Y * rot.Z)) ,
3752 (double)(1 - (2.0f * rot.X * rot.X) - (2.0f * rot.Z * rot.Z)));
3753 float y = Utils.RAD_TO_DEG * (float)Math.Asin ((double)((2.0f * rot.X * rot.Y) + (2.0f * rot.Z * rot.W)));
3754 float z = Utils.RAD_TO_DEG * (float)Math.Atan2(((double)(2.0f * rot.Y * rot.W) - (2.0f * rot.X * rot.Z)) ,
3755 (double)(1 - (2.0f * rot.Y * rot.Y) - (2.0f * rot.Z * rot.Z)));
3756 return(new Vector3(x,y,z));
3757 }
3758
3759
3738 } 3760 }
3739} 3761}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
index 98bbc68..23138ef 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OpenSim.Region.ScriptEngine.Shared.Api.Runtime.mdp
@@ -17,6 +17,8 @@
17 <excludeFiles /> 17 <excludeFiles />
18 </DeploymentInformation> 18 </DeploymentInformation>
19 <Contents> 19 <Contents>
20 <File name="./CM_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
21 <File name="./CM_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
20 <File name="./Executor.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 22 <File name="./Executor.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
21 <File name="./LSL_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 23 <File name="./LSL_Constants.cs" subtype="Code" buildaction="Compile" dependson="" data="" />
22 <File name="./LSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 24 <File name="./LSL_Stub.cs" subtype="Code" buildaction="Compile" dependson="" data="" />