aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie2009-12-12 12:54:43 +0000
committerMelanie2009-12-12 12:54:43 +0000
commitb310efc50f92d474f4b498fdb2d3a9a4144efae8 (patch)
tree2475da320221330f9f44f156e3c7b12bcd0decb7 /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' into careminster (diff)
parent* Bugfix mantis 4441, "Use of Autopilot isn't playing any animations." (diff)
downloadopensim-SC_OLD-b310efc50f92d474f4b498fdb2d3a9a4144efae8.zip
opensim-SC_OLD-b310efc50f92d474f4b498fdb2d3a9a4144efae8.tar.gz
opensim-SC_OLD-b310efc50f92d474f4b498fdb2d3a9a4144efae8.tar.bz2
opensim-SC_OLD-b310efc50f92d474f4b498fdb2d3a9a4144efae8.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs246
2 files changed, 231 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 50624a1..e98f0e7 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -128,7 +128,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
128 if (!m_scenePresence.IsChildAgent) 128 if (!m_scenePresence.IsChildAgent)
129 { 129 {
130 if (m_animations.TrySetDefaultAnimation( 130 if (m_animations.TrySetDefaultAnimation(
131 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero)) 131 anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, m_scenePresence.UUID))
132 { 132 {
133//Console.WriteLine("TSMA {0} success.", anim); 133//Console.WriteLine("TSMA {0} success.", anim);
134 // 16384 is CHANGED_ANIMATION 134 // 16384 is CHANGED_ANIMATION
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index fbc4ed5..c553ca0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -128,6 +128,7 @@ namespace OpenSim.Region.Framework.Scenes
128 private Vector3? m_forceToApply; 128 private Vector3? m_forceToApply;
129 private uint m_requestedSitTargetID; 129 private uint m_requestedSitTargetID;
130 private UUID m_requestedSitTargetUUID; 130 private UUID m_requestedSitTargetUUID;
131 private Vector3 m_requestedSitOffset;
131 private SendCourseLocationsMethod m_sendCourseLocationsMethod; 132 private SendCourseLocationsMethod m_sendCourseLocationsMethod;
132 133
133 private bool m_startAnimationSet; 134 private bool m_startAnimationSet;
@@ -1296,10 +1297,13 @@ namespace OpenSim.Region.Framework.Scenes
1296 { 1297 {
1297 return; 1298 return;
1298 } 1299 }
1300
1301 bool update_movementflag = false;
1302
1299 if (m_allowMovement) 1303 if (m_allowMovement)
1300 { 1304 {
1301 int i = 0; 1305 int i = 0;
1302 bool update_movementflag = false; 1306
1303 bool update_rotation = false; 1307 bool update_rotation = false;
1304 bool DCFlagKeyPressed = false; 1308 bool DCFlagKeyPressed = false;
1305 Vector3 agent_control_v3 = Vector3.Zero; 1309 Vector3 agent_control_v3 = Vector3.Zero;
@@ -1451,27 +1455,33 @@ namespace OpenSim.Region.Framework.Scenes
1451 if (LocalVectorToTarget2D.Y > 0)//MoveLeft 1455 if (LocalVectorToTarget2D.Y > 0)//MoveLeft
1452 { 1456 {
1453 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT; 1457 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
1458 //AgentControlFlags
1459 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
1454 update_movementflag = true; 1460 update_movementflag = true;
1455 } 1461 }
1456 else if (LocalVectorToTarget2D.Y < 0) //MoveRight 1462 else if (LocalVectorToTarget2D.Y < 0) //MoveRight
1457 { 1463 {
1458 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT; 1464 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
1465 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
1459 update_movementflag = true; 1466 update_movementflag = true;
1460 } 1467 }
1461 if (LocalVectorToTarget2D.X < 0) //MoveBack 1468 if (LocalVectorToTarget2D.X < 0) //MoveBack
1462 { 1469 {
1463 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK; 1470 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
1471 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
1464 update_movementflag = true; 1472 update_movementflag = true;
1465 } 1473 }
1466 else if (LocalVectorToTarget2D.X > 0) //Move Forward 1474 else if (LocalVectorToTarget2D.X > 0) //Move Forward
1467 { 1475 {
1468 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD; 1476 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
1477 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
1469 update_movementflag = true; 1478 update_movementflag = true;
1470 } 1479 }
1471 } 1480 }
1472 catch (Exception) 1481 catch (Exception e)
1473 { 1482 {
1474 //Avoid system crash, can be slower but... 1483 //Avoid system crash, can be slower but...
1484 m_log.DebugFormat("Crash! {0}", e.ToString());
1475 } 1485 }
1476 } 1486 }
1477 } 1487 }
@@ -1509,11 +1519,13 @@ namespace OpenSim.Region.Framework.Scenes
1509 1519
1510 AddNewMovement(agent_control_v3, q, Nudging); 1520 AddNewMovement(agent_control_v3, q, Nudging);
1511 1521
1512 if (update_movementflag) 1522
1513 Animator.UpdateMovementAnimations();
1514 } 1523 }
1515 } 1524 }
1516 1525
1526 if (update_movementflag)
1527 Animator.UpdateMovementAnimations();
1528
1517 m_scene.EventManager.TriggerOnClientMovement(this); 1529 m_scene.EventManager.TriggerOnClientMovement(this);
1518 1530
1519 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 1531 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
@@ -1712,11 +1724,12 @@ namespace OpenSim.Region.Framework.Scenes
1712 return targetPart; 1724 return targetPart;
1713 } 1725 }
1714 1726
1715 private void SendSitResponse(IClientAPI remoteClient, UUID targetID, Vector3 offset) 1727 private void SendSitResponse(IClientAPI remoteClient, UUID targetID, Vector3 offset, Quaternion pSitOrientation)
1716 { 1728 {
1717 bool autopilot = true; 1729 bool autopilot = true;
1718 Vector3 autopilotTarget = new Vector3(); 1730 Vector3 autopilotTarget = new Vector3();
1719 Quaternion sitOrientation = Quaternion.Identity; 1731 Quaternion sitOrientation = Quaternion.Identity;
1732 Vector3 pos = new Vector3();
1720 Vector3 cameraEyeOffset = Vector3.Zero; 1733 Vector3 cameraEyeOffset = Vector3.Zero;
1721 Vector3 cameraAtOffset = Vector3.Zero; 1734 Vector3 cameraAtOffset = Vector3.Zero;
1722 bool forceMouselook = false; 1735 bool forceMouselook = false;
@@ -1843,12 +1856,17 @@ namespace OpenSim.Region.Framework.Scenes
1843 m_nextSitAnimation = part.SitAnimation; 1856 m_nextSitAnimation = part.SitAnimation;
1844 } 1857 }
1845 m_requestedSitTargetID = part.LocalId; 1858 m_requestedSitTargetID = part.LocalId;
1846 //m_requestedSitOffset = offset; 1859 m_requestedSitOffset = offset;
1847 //offset.X += part.Scale.X;// *offset.X; 1860 m_requestedSitTargetUUID = targetID;
1848 //offset.Y += part.Scale.Y;// * offset.Y; 1861
1849 //offset.Z += part.Scale.Z;// * offset.Z;
1850 //m_requestedSitOffset = offset;
1851 m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset); 1862 m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset);
1863
1864 if (m_scene.PhysicsScene.SupportsRayCast())
1865 {
1866 //m_scene.PhysicsScene.RaycastWorld(Vector3.Zero,Vector3.Zero, 0.01f,new RaycastCallback());
1867 //SitRayCastAvatarPosition(part);
1868 //return;
1869 }
1852 } 1870 }
1853 else 1871 else
1854 { 1872 {
@@ -1856,14 +1874,201 @@ namespace OpenSim.Region.Framework.Scenes
1856 m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); 1874 m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
1857 } 1875 }
1858 1876
1859 if (m_scene.PhysicsScene.SupportsRayCast()) 1877
1878
1879 SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity);
1880 }
1881 /*
1882 public void SitRayCastAvatarPosition(SceneObjectPart part)
1883 {
1884 Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset;
1885 Vector3 StartRayCastPosition = AbsolutePosition;
1886 Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition);
1887 float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition);
1888 m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastAvatarPositionResponse);
1889 }
1890
1891 public void SitRayCastAvatarPositionResponse(bool hitYN, Vector3 collisionPoint, uint localid, float pdistance, Vector3 normal)
1892 {
1893 SceneObjectPart part = FindNextAvailableSitTarget(m_requestedSitTargetUUID);
1894 if (part != null)
1895 {
1896 if (hitYN)
1897 {
1898 if (collisionPoint.ApproxEquals(m_requestedSitOffset + part.AbsolutePosition, 0.2f))
1899 {
1900 SitRaycastFindEdge(collisionPoint, normal);
1901 m_log.DebugFormat("[SIT]: Raycast Avatar Position succeeded at point: {0}, normal:{1}", collisionPoint, normal );
1902 }
1903 else
1904 {
1905 SitRayCastAvatarPositionCameraZ(part);
1906 }
1907 }
1908 else
1909 {
1910 SitRayCastAvatarPositionCameraZ(part);
1911 }
1912 }
1913 else
1914 {
1915 ControllingClient.SendAlertMessage("Sit position no longer exists");
1916 m_requestedSitTargetUUID = UUID.Zero;
1917 m_requestedSitTargetID = 0;
1918 m_requestedSitOffset = Vector3.Zero;
1919 }
1920
1921 }
1922
1923 public void SitRayCastAvatarPositionCameraZ(SceneObjectPart part)
1924 {
1925 // Next, try to raycast from the camera Z position
1926 Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset;
1927 Vector3 StartRayCastPosition = AbsolutePosition; StartRayCastPosition.Z = CameraPosition.Z;
1928 Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition);
1929 float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition);
1930 m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastAvatarPositionCameraZResponse);
1931 }
1932
1933 public void SitRayCastAvatarPositionCameraZResponse(bool hitYN, Vector3 collisionPoint, uint localid, float pdistance, Vector3 normal)
1934 {
1935 SceneObjectPart part = FindNextAvailableSitTarget(m_requestedSitTargetUUID);
1936 if (part != null)
1937 {
1938 if (hitYN)
1939 {
1940 if (collisionPoint.ApproxEquals(m_requestedSitOffset + part.AbsolutePosition, 0.2f))
1941 {
1942 SitRaycastFindEdge(collisionPoint, normal);
1943 m_log.DebugFormat("[SIT]: Raycast Avatar Position + CameraZ succeeded at point: {0}, normal:{1}", collisionPoint, normal);
1944 }
1945 else
1946 {
1947 SitRayCastCameraPosition(part);
1948 }
1949 }
1950 else
1951 {
1952 SitRayCastCameraPosition(part);
1953 }
1954 }
1955 else
1860 { 1956 {
1861 //m_scene.PhysicsScene.RaycastWorld(Vector3.Zero,Vector3.Zero, 0.01f,new RaycastCallback()); 1957 ControllingClient.SendAlertMessage("Sit position no longer exists");
1958 m_requestedSitTargetUUID = UUID.Zero;
1959 m_requestedSitTargetID = 0;
1960 m_requestedSitOffset = Vector3.Zero;
1862 } 1961 }
1863 1962
1864 SendSitResponse(remoteClient, targetID, offset);
1865 } 1963 }
1866 1964
1965 public void SitRayCastCameraPosition(SceneObjectPart part)
1966 {
1967 // Next, try to raycast from the camera position
1968 Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset;
1969 Vector3 StartRayCastPosition = CameraPosition;
1970 Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition);
1971 float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition);
1972 m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastCameraPositionResponse);
1973 }
1974
1975 public void SitRayCastCameraPositionResponse(bool hitYN, Vector3 collisionPoint, uint localid, float pdistance, Vector3 normal)
1976 {
1977 SceneObjectPart part = FindNextAvailableSitTarget(m_requestedSitTargetUUID);
1978 if (part != null)
1979 {
1980 if (hitYN)
1981 {
1982 if (collisionPoint.ApproxEquals(m_requestedSitOffset + part.AbsolutePosition, 0.2f))
1983 {
1984 SitRaycastFindEdge(collisionPoint, normal);
1985 m_log.DebugFormat("[SIT]: Raycast Camera Position succeeded at point: {0}, normal:{1}", collisionPoint, normal);
1986 }
1987 else
1988 {
1989 SitRayHorizontal(part);
1990 }
1991 }
1992 else
1993 {
1994 SitRayHorizontal(part);
1995 }
1996 }
1997 else
1998 {
1999 ControllingClient.SendAlertMessage("Sit position no longer exists");
2000 m_requestedSitTargetUUID = UUID.Zero;
2001 m_requestedSitTargetID = 0;
2002 m_requestedSitOffset = Vector3.Zero;
2003 }
2004
2005 }
2006
2007 public void SitRayHorizontal(SceneObjectPart part)
2008 {
2009 // Next, try to raycast from the avatar position to fwd
2010 Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset;
2011 Vector3 StartRayCastPosition = CameraPosition;
2012 Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition);
2013 float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition);
2014 m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastHorizontalResponse);
2015 }
2016
2017 public void SitRayCastHorizontalResponse(bool hitYN, Vector3 collisionPoint, uint localid, float pdistance, Vector3 normal)
2018 {
2019 SceneObjectPart part = FindNextAvailableSitTarget(m_requestedSitTargetUUID);
2020 if (part != null)
2021 {
2022 if (hitYN)
2023 {
2024 if (collisionPoint.ApproxEquals(m_requestedSitOffset + part.AbsolutePosition, 0.2f))
2025 {
2026 SitRaycastFindEdge(collisionPoint, normal);
2027 m_log.DebugFormat("[SIT]: Raycast Horizontal Position succeeded at point: {0}, normal:{1}", collisionPoint, normal);
2028 // Next, try to raycast from the camera position
2029 Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset;
2030 Vector3 StartRayCastPosition = CameraPosition;
2031 Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition);
2032 float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition);
2033 //m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastResponseAvatarPosition);
2034 }
2035 else
2036 {
2037 ControllingClient.SendAlertMessage("Sit position not accessable.");
2038 m_requestedSitTargetUUID = UUID.Zero;
2039 m_requestedSitTargetID = 0;
2040 m_requestedSitOffset = Vector3.Zero;
2041 }
2042 }
2043 else
2044 {
2045 ControllingClient.SendAlertMessage("Sit position not accessable.");
2046 m_requestedSitTargetUUID = UUID.Zero;
2047 m_requestedSitTargetID = 0;
2048 m_requestedSitOffset = Vector3.Zero;
2049 }
2050 }
2051 else
2052 {
2053 ControllingClient.SendAlertMessage("Sit position no longer exists");
2054 m_requestedSitTargetUUID = UUID.Zero;
2055 m_requestedSitTargetID = 0;
2056 m_requestedSitOffset = Vector3.Zero;
2057 }
2058
2059 }
2060
2061 private void SitRaycastFindEdge(Vector3 collisionPoint, Vector3 collisionNormal)
2062 {
2063 int i = 0;
2064 //throw new NotImplementedException();
2065 //m_requestedSitTargetUUID = UUID.Zero;
2066 //m_requestedSitTargetID = 0;
2067 //m_requestedSitOffset = Vector3.Zero;
2068
2069 SendSitResponse(ControllingClient, m_requestedSitTargetUUID, collisionPoint - m_requestedSitOffset, Quaternion.Identity);
2070 }
2071 */
1867 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation) 2072 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation)
1868 { 2073 {
1869 if (m_parentID != 0) 2074 if (m_parentID != 0)
@@ -1884,14 +2089,23 @@ namespace OpenSim.Region.Framework.Scenes
1884 if (part != null) 2089 if (part != null)
1885 { 2090 {
1886 m_requestedSitTargetID = part.LocalId; 2091 m_requestedSitTargetID = part.LocalId;
1887 //m_requestedSitOffset = offset; 2092 m_requestedSitOffset = offset;
2093 m_requestedSitTargetUUID = targetID;
2094
2095 m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset);
2096
2097 if (m_scene.PhysicsScene.SupportsRayCast())
2098 {
2099 //SitRayCastAvatarPosition(part);
2100 //return;
2101 }
1888 } 2102 }
1889 else 2103 else
1890 { 2104 {
1891 m_log.Warn("Sit requested on unknown object: " + targetID); 2105 m_log.Warn("Sit requested on unknown object: " + targetID);
1892 } 2106 }
1893 2107
1894 SendSitResponse(remoteClient, targetID, offset); 2108 SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity);
1895 } 2109 }
1896 2110
1897 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) 2111 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)