aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs293
1 files changed, 214 insertions, 79 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index d1bc351..56b2f13 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -139,15 +139,15 @@ namespace OpenSim.Region.Framework.Scenes
139 public uint TimeStampTerse; 139 public uint TimeStampTerse;
140 140
141 [XmlIgnore] 141 [XmlIgnore]
142 public UUID FromItemID; 142 public UUID FromItemID;
143 143
144 [XmlIgnore] 144 [XmlIgnore]
145 public int STATUS_ROTATE_X; 145 public int STATUS_ROTATE_X;
146 146
147 [XmlIgnore] 147 [XmlIgnore]
148 public int STATUS_ROTATE_Y; 148 public int STATUS_ROTATE_Y;
149 149
150 [XmlIgnore] 150 [XmlIgnore]
151 public int STATUS_ROTATE_Z; 151 public int STATUS_ROTATE_Z;
152 152
153 [XmlIgnore] 153 [XmlIgnore]
@@ -1680,19 +1680,19 @@ namespace OpenSim.Region.Framework.Scenes
1680 return false; 1680 return false;
1681 1681
1682 return m_parentGroup.RootPart.DIE_AT_EDGE; 1682 return m_parentGroup.RootPart.DIE_AT_EDGE;
1683 } 1683 }
1684 1684
1685 public int GetAxisRotation(int axis) 1685 public int GetAxisRotation(int axis)
1686 { 1686 {
1687 //Cannot use ScriptBaseClass constants as no referance to it currently. 1687 //Cannot use ScriptBaseClass constants as no referance to it currently.
1688 if (axis == 2)//STATUS_ROTATE_X 1688 if (axis == 2)//STATUS_ROTATE_X
1689 return STATUS_ROTATE_X; 1689 return STATUS_ROTATE_X;
1690 if (axis == 4)//STATUS_ROTATE_Y 1690 if (axis == 4)//STATUS_ROTATE_Y
1691 return STATUS_ROTATE_Y; 1691 return STATUS_ROTATE_Y;
1692 if (axis == 8)//STATUS_ROTATE_Z 1692 if (axis == 8)//STATUS_ROTATE_Z
1693 return STATUS_ROTATE_Z; 1693 return STATUS_ROTATE_Z;
1694 1694
1695 return 0; 1695 return 0;
1696 } 1696 }
1697 1697
1698 public double GetDistanceTo(Vector3 a, Vector3 b) 1698 public double GetDistanceTo(Vector3 a, Vector3 b)
@@ -1853,16 +1853,12 @@ namespace OpenSim.Region.Framework.Scenes
1853 // and build up list of colliders this time 1853 // and build up list of colliders this time
1854 foreach (uint localid in collissionswith.Keys) 1854 foreach (uint localid in collissionswith.Keys)
1855 { 1855 {
1856 if (localid != 0) 1856 thisHitColliders.Add(localid);
1857 if (!m_lastColliders.Contains(localid))
1857 { 1858 {
1858 thisHitColliders.Add(localid); 1859 startedColliders.Add(localid);
1859 if (!m_lastColliders.Contains(localid))
1860 {
1861 startedColliders.Add(localid);
1862 }
1863
1864 //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
1865 } 1860 }
1861 //m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
1866 } 1862 }
1867 1863
1868 // calculate things that ended colliding 1864 // calculate things that ended colliding
@@ -1904,6 +1900,8 @@ namespace OpenSim.Region.Framework.Scenes
1904 List<DetectedObject> colliding = new List<DetectedObject>(); 1900 List<DetectedObject> colliding = new List<DetectedObject>();
1905 foreach (uint localId in startedColliders) 1901 foreach (uint localId in startedColliders)
1906 { 1902 {
1903 if (localId == 0)
1904 return;
1907 // always running this check because if the user deletes the object it would return a null reference. 1905 // always running this check because if the user deletes the object it would return a null reference.
1908 if (m_parentGroup == null) 1906 if (m_parentGroup == null)
1909 return; 1907 return;
@@ -1936,24 +1934,24 @@ namespace OpenSim.Region.Framework.Scenes
1936 else 1934 else
1937 { 1935 {
1938 } 1936 }
1939 } 1937 }
1940 else 1938 else
1941 { 1939 {
1942 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1940 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1943 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work 1941 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
1944 if (found) 1942 if (!found)
1945 { 1943 {
1946 DetectedObject detobj = new DetectedObject(); 1944 DetectedObject detobj = new DetectedObject();
1947 detobj.keyUUID = obj.UUID; 1945 detobj.keyUUID = obj.UUID;
1948 detobj.nameStr = obj.Name; 1946 detobj.nameStr = obj.Name;
1949 detobj.ownerUUID = obj._ownerID; 1947 detobj.ownerUUID = obj._ownerID;
1950 detobj.posVector = obj.AbsolutePosition; 1948 detobj.posVector = obj.AbsolutePosition;
1951 detobj.rotQuat = obj.GetWorldRotation(); 1949 detobj.rotQuat = obj.GetWorldRotation();
1952 detobj.velVector = obj.Velocity; 1950 detobj.velVector = obj.Velocity;
1953 detobj.colliderType = 0; 1951 detobj.colliderType = 0;
1954 detobj.groupUUID = obj._groupID; 1952 detobj.groupUUID = obj._groupID;
1955 colliding.Add(detobj); 1953 colliding.Add(detobj);
1956 } 1954 }
1957 } 1955 }
1958 } 1956 }
1959 else 1957 else
@@ -1965,7 +1963,7 @@ namespace OpenSim.Region.Framework.Scenes
1965 ScenePresence av = avlist[i]; 1963 ScenePresence av = avlist[i];
1966 1964
1967 if (av.LocalId == localId) 1965 if (av.LocalId == localId)
1968 { 1966 {
1969 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 1967 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
1970 { 1968 {
1971 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1969 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
@@ -1987,24 +1985,24 @@ namespace OpenSim.Region.Framework.Scenes
1987 else 1985 else
1988 { 1986 {
1989 } 1987 }
1990 } 1988 }
1991 else 1989 else
1992 { 1990 {
1993 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 1991 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
1994 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work 1992 //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work
1995 if (!found) 1993 if (!found)
1996 { 1994 {
1997 DetectedObject detobj = new DetectedObject(); 1995 DetectedObject detobj = new DetectedObject();
1998 detobj.keyUUID = av.UUID; 1996 detobj.keyUUID = av.UUID;
1999 detobj.nameStr = av.ControllingClient.Name; 1997 detobj.nameStr = av.ControllingClient.Name;
2000 detobj.ownerUUID = av.UUID; 1998 detobj.ownerUUID = av.UUID;
2001 detobj.posVector = av.AbsolutePosition; 1999 detobj.posVector = av.AbsolutePosition;
2002 detobj.rotQuat = av.Rotation; 2000 detobj.rotQuat = av.Rotation;
2003 detobj.velVector = av.Velocity; 2001 detobj.velVector = av.Velocity;
2004 detobj.colliderType = 0; 2002 detobj.colliderType = 0;
2005 detobj.groupUUID = av.ControllingClient.ActiveGroupId; 2003 detobj.groupUUID = av.ControllingClient.ActiveGroupId;
2006 colliding.Add(detobj); 2004 colliding.Add(detobj);
2007 } 2005 }
2008 } 2006 }
2009 2007
2010 } 2008 }
@@ -2039,7 +2037,7 @@ namespace OpenSim.Region.Framework.Scenes
2039 { 2037 {
2040 // always running this check because if the user deletes the object it would return a null reference. 2038 // always running this check because if the user deletes the object it would return a null reference.
2041 if (localId == 0) 2039 if (localId == 0)
2042 continue; 2040 return;
2043 2041
2044 if (m_parentGroup == null) 2042 if (m_parentGroup == null)
2045 return; 2043 return;
@@ -2077,7 +2075,7 @@ namespace OpenSim.Region.Framework.Scenes
2077 { 2075 {
2078 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2076 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2079 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work 2077 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2080 if (found) 2078 if (!found)
2081 { 2079 {
2082 DetectedObject detobj = new DetectedObject(); 2080 DetectedObject detobj = new DetectedObject();
2083 detobj.keyUUID = obj.UUID; 2081 detobj.keyUUID = obj.UUID;
@@ -2101,7 +2099,7 @@ namespace OpenSim.Region.Framework.Scenes
2101 ScenePresence av = avlist[i]; 2099 ScenePresence av = avlist[i];
2102 2100
2103 if (av.LocalId == localId) 2101 if (av.LocalId == localId)
2104 { 2102 {
2105 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 2103 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2106 { 2104 {
2107 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2105 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
@@ -2171,7 +2169,7 @@ namespace OpenSim.Region.Framework.Scenes
2171 foreach (uint localId in endedColliders) 2169 foreach (uint localId in endedColliders)
2172 { 2170 {
2173 if (localId == 0) 2171 if (localId == 0)
2174 continue; 2172 return;
2175 2173
2176 // always running this check because if the user deletes the object it would return a null reference. 2174 // always running this check because if the user deletes the object it would return a null reference.
2177 if (m_parentGroup == null) 2175 if (m_parentGroup == null)
@@ -2208,7 +2206,7 @@ namespace OpenSim.Region.Framework.Scenes
2208 { 2206 {
2209 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2207 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
2210 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work 2208 //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work
2211 if (found) 2209 if (!found)
2212 { 2210 {
2213 DetectedObject detobj = new DetectedObject(); 2211 DetectedObject detobj = new DetectedObject();
2214 detobj.keyUUID = obj.UUID; 2212 detobj.keyUUID = obj.UUID;
@@ -2232,7 +2230,7 @@ namespace OpenSim.Region.Framework.Scenes
2232 ScenePresence av = avlist[i]; 2230 ScenePresence av = avlist[i];
2233 2231
2234 if (av.LocalId == localId) 2232 if (av.LocalId == localId)
2235 { 2233 {
2236 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name)) 2234 if (m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(av.Name))
2237 { 2235 {
2238 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); 2236 bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data);
@@ -2292,7 +2290,121 @@ namespace OpenSim.Region.Framework.Scenes
2292 m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage); 2290 m_parentGroup.Scene.EventManager.TriggerScriptCollidingEnd(LocalId, EndCollidingMessage);
2293 } 2291 }
2294 } 2292 }
2295 } 2293 }
2294 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_start) != 0)
2295 {
2296 if (startedColliders.Count > 0)
2297 {
2298 ColliderArgs LandStartCollidingMessage = new ColliderArgs();
2299 List<DetectedObject> colliding = new List<DetectedObject>();
2300 foreach (uint localId in startedColliders)
2301 {
2302 if (localId == 0)
2303 {
2304 //Hope that all is left is ground!
2305 DetectedObject detobj = new DetectedObject();
2306 detobj.keyUUID = UUID.Zero;
2307 detobj.nameStr = "";
2308 detobj.ownerUUID = UUID.Zero;
2309 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2310 detobj.rotQuat = Quaternion.Identity;
2311 detobj.velVector = Vector3.Zero;
2312 detobj.colliderType = 0;
2313 detobj.groupUUID = UUID.Zero;
2314 colliding.Add(detobj);
2315 }
2316 }
2317
2318 if (colliding.Count > 0)
2319 {
2320 LandStartCollidingMessage.Colliders = colliding;
2321 // always running this check because if the user deletes the object it would return a null reference.
2322 if (m_parentGroup == null)
2323 return;
2324
2325 if (m_parentGroup.Scene == null)
2326 return;
2327
2328 m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingStart(LocalId, LandStartCollidingMessage);
2329 }
2330 }
2331 }
2332 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision) != 0)
2333 {
2334 if (m_lastColliders.Count > 0)
2335 {
2336 ColliderArgs LandCollidingMessage = new ColliderArgs();
2337 List<DetectedObject> colliding = new List<DetectedObject>();
2338 foreach (uint localId in startedColliders)
2339 {
2340 if (localId == 0)
2341 {
2342 //Hope that all is left is ground!
2343 DetectedObject detobj = new DetectedObject();
2344 detobj.keyUUID = UUID.Zero;
2345 detobj.nameStr = "";
2346 detobj.ownerUUID = UUID.Zero;
2347 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2348 detobj.rotQuat = Quaternion.Identity;
2349 detobj.velVector = Vector3.Zero;
2350 detobj.colliderType = 0;
2351 detobj.groupUUID = UUID.Zero;
2352 colliding.Add(detobj);
2353 }
2354 }
2355
2356 if (colliding.Count > 0)
2357 {
2358 LandCollidingMessage.Colliders = colliding;
2359 // always running this check because if the user deletes the object it would return a null reference.
2360 if (m_parentGroup == null)
2361 return;
2362
2363 if (m_parentGroup.Scene == null)
2364 return;
2365
2366 m_parentGroup.Scene.EventManager.TriggerScriptLandColliding(LocalId, LandCollidingMessage);
2367 }
2368 }
2369 }
2370 if ((m_parentGroup.RootPart.ScriptEvents & scriptEvents.land_collision_end) != 0)
2371 {
2372 if (endedColliders.Count > 0)
2373 {
2374 ColliderArgs LandEndCollidingMessage = new ColliderArgs();
2375 List<DetectedObject> colliding = new List<DetectedObject>();
2376 foreach (uint localId in startedColliders)
2377 {
2378 if (localId == 0)
2379 {
2380 //Hope that all is left is ground!
2381 DetectedObject detobj = new DetectedObject();
2382 detobj.keyUUID = UUID.Zero;
2383 detobj.nameStr = "";
2384 detobj.ownerUUID = UUID.Zero;
2385 detobj.posVector = m_parentGroup.RootPart.AbsolutePosition;
2386 detobj.rotQuat = Quaternion.Identity;
2387 detobj.velVector = Vector3.Zero;
2388 detobj.colliderType = 0;
2389 detobj.groupUUID = UUID.Zero;
2390 colliding.Add(detobj);
2391 }
2392 }
2393
2394 if (colliding.Count > 0)
2395 {
2396 LandEndCollidingMessage.Colliders = colliding;
2397 // always running this check because if the user deletes the object it would return a null reference.
2398 if (m_parentGroup == null)
2399 return;
2400
2401 if (m_parentGroup.Scene == null)
2402 return;
2403
2404 m_parentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd(LocalId, LandEndCollidingMessage);
2405 }
2406 }
2407 }
2296 } 2408 }
2297 2409
2298 public void PhysicsOutOfBounds(Vector3 pos) 2410 public void PhysicsOutOfBounds(Vector3 pos)
@@ -2758,13 +2870,13 @@ namespace OpenSim.Region.Framework.Scenes
2758 if (m_parentGroup != null) 2870 if (m_parentGroup != null)
2759 { 2871 {
2760 m_parentGroup.SetAxisRotation(axis, rotate); 2872 m_parentGroup.SetAxisRotation(axis, rotate);
2761 } 2873 }
2762 //Cannot use ScriptBaseClass constants as no referance to it currently. 2874 //Cannot use ScriptBaseClass constants as no referance to it currently.
2763 if (axis == 2)//STATUS_ROTATE_X 2875 if (axis == 2)//STATUS_ROTATE_X
2764 STATUS_ROTATE_X = rotate; 2876 STATUS_ROTATE_X = rotate;
2765 if (axis == 4)//STATUS_ROTATE_Y 2877 if (axis == 4)//STATUS_ROTATE_Y
2766 STATUS_ROTATE_Y = rotate; 2878 STATUS_ROTATE_Y = rotate;
2767 if (axis == 8)//STATUS_ROTATE_Z 2879 if (axis == 8)//STATUS_ROTATE_Z
2768 STATUS_ROTATE_Z = rotate; 2880 STATUS_ROTATE_Z = rotate;
2769 } 2881 }
2770 2882
@@ -3698,6 +3810,9 @@ namespace OpenSim.Region.Framework.Scenes
3698 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 3810 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3699 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 3811 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3700 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 3812 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
3813 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
3814 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
3815 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
3701 (CollisionSound != UUID.Zero) 3816 (CollisionSound != UUID.Zero)
3702 ) 3817 )
3703 { 3818 {
@@ -3902,6 +4017,9 @@ namespace OpenSim.Region.Framework.Scenes
3902 ((AggregateScriptEvents & scriptEvents.collision) != 0) || 4017 ((AggregateScriptEvents & scriptEvents.collision) != 0) ||
3903 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) || 4018 ((AggregateScriptEvents & scriptEvents.collision_end) != 0) ||
3904 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) || 4019 ((AggregateScriptEvents & scriptEvents.collision_start) != 0) ||
4020 ((AggregateScriptEvents & scriptEvents.land_collision_start) != 0) ||
4021 ((AggregateScriptEvents & scriptEvents.land_collision) != 0) ||
4022 ((AggregateScriptEvents & scriptEvents.land_collision_end) != 0) ||
3905 (CollisionSound != UUID.Zero) 4023 (CollisionSound != UUID.Zero)
3906 ) 4024 )
3907 { 4025 {
@@ -3962,6 +4080,23 @@ namespace OpenSim.Region.Framework.Scenes
3962 } 4080 }
3963 } 4081 }
3964 4082
4083 public int registerRotTargetWaypoint(Quaternion target, float tolerance)
4084 {
4085 if (m_parentGroup != null)
4086 {
4087 return m_parentGroup.registerRotTargetWaypoint(target, tolerance);
4088 }
4089 return 0;
4090 }
4091
4092 public void unregisterRotTargetWaypoint(int handle)
4093 {
4094 if (m_parentGroup != null)
4095 {
4096 m_parentGroup.unregisterRotTargetWaypoint(handle);
4097 }
4098 }
4099
3965 public void SetCameraAtOffset(Vector3 v) 4100 public void SetCameraAtOffset(Vector3 v)
3966 { 4101 {
3967 m_cameraAtOffset = v; 4102 m_cameraAtOffset = v;