diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 327 |
1 files changed, 265 insertions, 62 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c0243a5..b50def3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -140,6 +140,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | 140 | ||
141 | [XmlIgnore] | 141 | [XmlIgnore] |
142 | public UUID FromItemID; | 142 | public UUID FromItemID; |
143 | |||
144 | [XmlIgnore] | ||
145 | private Dictionary<int, string> m_CollisionFilter = new Dictionary<int, string>(); | ||
143 | 146 | ||
144 | /// <value> | 147 | /// <value> |
145 | /// The UUID of the user inventory item from which this object was rezzed if this is a root part. | 148 | /// The UUID of the user inventory item from which this object was rezzed if this is a root part. |
@@ -452,6 +455,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
452 | } | 455 | } |
453 | } | 456 | } |
454 | 457 | ||
458 | |||
459 | [XmlIgnore] | ||
460 | public Dictionary<int, string> CollisionFilter | ||
461 | { | ||
462 | get { return m_CollisionFilter; } | ||
463 | set | ||
464 | { | ||
465 | m_CollisionFilter = value; | ||
466 | } | ||
467 | } | ||
468 | |||
455 | public ulong RegionHandle | 469 | public ulong RegionHandle |
456 | { | 470 | { |
457 | get { return m_regionHandle; } | 471 | get { return m_regionHandle; } |
@@ -1876,18 +1890,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
1876 | return; | 1890 | return; |
1877 | 1891 | ||
1878 | SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); | 1892 | SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); |
1893 | string data = ""; | ||
1879 | if (obj != null) | 1894 | if (obj != null) |
1880 | { | 1895 | { |
1881 | DetectedObject detobj = new DetectedObject(); | 1896 | if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) |
1882 | detobj.keyUUID = obj.UUID; | 1897 | { |
1883 | detobj.nameStr = obj.Name; | 1898 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); |
1884 | detobj.ownerUUID = obj._ownerID; | 1899 | //If it is 1, it is to accept ONLY collisions from this object |
1885 | detobj.posVector = obj.AbsolutePosition; | 1900 | if(found) |
1886 | detobj.rotQuat = obj.GetWorldRotation(); | 1901 | { |
1887 | detobj.velVector = obj.Velocity; | 1902 | DetectedObject detobj = new DetectedObject(); |
1888 | detobj.colliderType = 0; | 1903 | detobj.keyUUID = obj.UUID; |
1889 | detobj.groupUUID = obj._groupID; | 1904 | detobj.nameStr = obj.Name; |
1890 | colliding.Add(detobj); | 1905 | detobj.ownerUUID = obj._ownerID; |
1906 | detobj.posVector = obj.AbsolutePosition; | ||
1907 | detobj.rotQuat = obj.GetWorldRotation(); | ||
1908 | detobj.velVector = obj.Velocity; | ||
1909 | detobj.colliderType = 0; | ||
1910 | detobj.groupUUID = obj._groupID; | ||
1911 | colliding.Add(detobj); | ||
1912 | } | ||
1913 | //If it is 0, it is to not accept collisions from this object | ||
1914 | else | ||
1915 | { | ||
1916 | } | ||
1917 | } | ||
1918 | else | ||
1919 | { | ||
1920 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); | ||
1921 | //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work | ||
1922 | if(found) | ||
1923 | { | ||
1924 | DetectedObject detobj = new DetectedObject(); | ||
1925 | detobj.keyUUID = obj.UUID; | ||
1926 | detobj.nameStr = obj.Name; | ||
1927 | detobj.ownerUUID = obj._ownerID; | ||
1928 | detobj.posVector = obj.AbsolutePosition; | ||
1929 | detobj.rotQuat = obj.GetWorldRotation(); | ||
1930 | detobj.velVector = obj.Velocity; | ||
1931 | detobj.colliderType = 0; | ||
1932 | detobj.groupUUID = obj._groupID; | ||
1933 | colliding.Add(detobj); | ||
1934 | } | ||
1935 | } | ||
1891 | } | 1936 | } |
1892 | else | 1937 | else |
1893 | { | 1938 | { |
@@ -1899,16 +1944,47 @@ namespace OpenSim.Region.Framework.Scenes | |||
1899 | 1944 | ||
1900 | if (av.LocalId == localId) | 1945 | if (av.LocalId == localId) |
1901 | { | 1946 | { |
1902 | DetectedObject detobj = new DetectedObject(); | 1947 | if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) |
1903 | detobj.keyUUID = av.UUID; | 1948 | { |
1904 | detobj.nameStr = av.ControllingClient.Name; | 1949 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); |
1905 | detobj.ownerUUID = av.UUID; | 1950 | //If it is 1, it is to accept ONLY collisions from this avatar |
1906 | detobj.posVector = av.AbsolutePosition; | 1951 | if(found) |
1907 | detobj.rotQuat = av.Rotation; | 1952 | { |
1908 | detobj.velVector = av.Velocity; | 1953 | DetectedObject detobj = new DetectedObject(); |
1909 | detobj.colliderType = 0; | 1954 | detobj.keyUUID = av.UUID; |
1910 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | 1955 | detobj.nameStr = av.ControllingClient.Name; |
1911 | colliding.Add(detobj); | 1956 | detobj.ownerUUID = av.UUID; |
1957 | detobj.posVector = av.AbsolutePosition; | ||
1958 | detobj.rotQuat = av.Rotation; | ||
1959 | detobj.velVector = av.Velocity; | ||
1960 | detobj.colliderType = 0; | ||
1961 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | ||
1962 | colliding.Add(detobj); | ||
1963 | } | ||
1964 | //If it is 0, it is to not accept collisions from this avatar | ||
1965 | else | ||
1966 | { | ||
1967 | } | ||
1968 | } | ||
1969 | else | ||
1970 | { | ||
1971 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); | ||
1972 | //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work | ||
1973 | if(found) | ||
1974 | { | ||
1975 | DetectedObject detobj = new DetectedObject(); | ||
1976 | detobj.keyUUID = av.UUID; | ||
1977 | detobj.nameStr = av.ControllingClient.Name; | ||
1978 | detobj.ownerUUID = av.UUID; | ||
1979 | detobj.posVector = av.AbsolutePosition; | ||
1980 | detobj.rotQuat = av.Rotation; | ||
1981 | detobj.velVector = av.Velocity; | ||
1982 | detobj.colliderType = 0; | ||
1983 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | ||
1984 | colliding.Add(detobj); | ||
1985 | } | ||
1986 | } | ||
1987 | |||
1912 | } | 1988 | } |
1913 | } | 1989 | } |
1914 | } | 1990 | } |
@@ -1922,7 +1998,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1922 | 1998 | ||
1923 | if (m_parentGroup.Scene == null) | 1999 | if (m_parentGroup.Scene == null) |
1924 | return; | 2000 | return; |
1925 | 2001 | if(m_parentGroup.PassCollision == true) | |
2002 | { | ||
2003 | //TODO: Add pass to root prim! | ||
2004 | } | ||
1926 | m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage); | 2005 | m_parentGroup.Scene.EventManager.TriggerScriptCollidingStart(LocalId, StartCollidingMessage); |
1927 | } | 2006 | } |
1928 | } | 2007 | } |
@@ -1947,39 +2026,101 @@ namespace OpenSim.Region.Framework.Scenes | |||
1947 | return; | 2026 | return; |
1948 | 2027 | ||
1949 | SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); | 2028 | SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); |
2029 | string data = ""; | ||
1950 | if (obj != null) | 2030 | if (obj != null) |
1951 | { | 2031 | { |
1952 | DetectedObject detobj = new DetectedObject(); | 2032 | if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) |
1953 | detobj.keyUUID = obj.UUID; | 2033 | { |
1954 | detobj.nameStr = obj.Name; | 2034 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); |
1955 | detobj.ownerUUID = obj._ownerID; | 2035 | //If it is 1, it is to accept ONLY collisions from this object |
1956 | detobj.posVector = obj.AbsolutePosition; | 2036 | if(found) |
1957 | detobj.rotQuat = obj.GetWorldRotation(); | 2037 | { |
1958 | detobj.velVector = obj.Velocity; | 2038 | DetectedObject detobj = new DetectedObject(); |
1959 | detobj.colliderType = 0; | 2039 | detobj.keyUUID = obj.UUID; |
1960 | detobj.groupUUID = obj._groupID; | 2040 | detobj.nameStr = obj.Name; |
1961 | colliding.Add(detobj); | 2041 | detobj.ownerUUID = obj._ownerID; |
2042 | detobj.posVector = obj.AbsolutePosition; | ||
2043 | detobj.rotQuat = obj.GetWorldRotation(); | ||
2044 | detobj.velVector = obj.Velocity; | ||
2045 | detobj.colliderType = 0; | ||
2046 | detobj.groupUUID = obj._groupID; | ||
2047 | colliding.Add(detobj); | ||
2048 | } | ||
2049 | //If it is 0, it is to not accept collisions from this object | ||
2050 | else | ||
2051 | { | ||
2052 | } | ||
2053 | } | ||
2054 | else | ||
2055 | { | ||
2056 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); | ||
2057 | //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work | ||
2058 | if(found) | ||
2059 | { | ||
2060 | DetectedObject detobj = new DetectedObject(); | ||
2061 | detobj.keyUUID = obj.UUID; | ||
2062 | detobj.nameStr = obj.Name; | ||
2063 | detobj.ownerUUID = obj._ownerID; | ||
2064 | detobj.posVector = obj.AbsolutePosition; | ||
2065 | detobj.rotQuat = obj.GetWorldRotation(); | ||
2066 | detobj.velVector = obj.Velocity; | ||
2067 | detobj.colliderType = 0; | ||
2068 | detobj.groupUUID = obj._groupID; | ||
2069 | colliding.Add(detobj); | ||
2070 | } | ||
2071 | } | ||
1962 | } | 2072 | } |
1963 | else | 2073 | else |
1964 | { | 2074 | { |
1965 | ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); | 2075 | ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); |
1966 | 2076 | ||
1967 | for (int i = 0; i < avlist.Length; i++) | 2077 | for (int i = 0; i < avlist.Length; i++) |
1968 | { | 2078 | { |
1969 | ScenePresence av = avlist[i]; | 2079 | ScenePresence av = avlist[i]; |
1970 | 2080 | ||
1971 | if (av.LocalId == localId) | 2081 | if (av.LocalId == localId) |
1972 | { | 2082 | { |
1973 | DetectedObject detobj = new DetectedObject(); | 2083 | if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) |
1974 | detobj.keyUUID = av.UUID; | 2084 | { |
1975 | detobj.nameStr = av.Name; | 2085 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); |
1976 | detobj.ownerUUID = av.UUID; | 2086 | //If it is 1, it is to accept ONLY collisions from this avatar |
1977 | detobj.posVector = av.AbsolutePosition; | 2087 | if(found) |
1978 | detobj.rotQuat = av.Rotation; | 2088 | { |
1979 | detobj.velVector = av.Velocity; | 2089 | DetectedObject detobj = new DetectedObject(); |
1980 | detobj.colliderType = 0; | 2090 | detobj.keyUUID = av.UUID; |
1981 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | 2091 | detobj.nameStr = av.ControllingClient.Name; |
1982 | colliding.Add(detobj); | 2092 | detobj.ownerUUID = av.UUID; |
2093 | detobj.posVector = av.AbsolutePosition; | ||
2094 | detobj.rotQuat = av.Rotation; | ||
2095 | detobj.velVector = av.Velocity; | ||
2096 | detobj.colliderType = 0; | ||
2097 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | ||
2098 | colliding.Add(detobj); | ||
2099 | } | ||
2100 | //If it is 0, it is to not accept collisions from this avatar | ||
2101 | else | ||
2102 | { | ||
2103 | } | ||
2104 | } | ||
2105 | else | ||
2106 | { | ||
2107 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); | ||
2108 | //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work | ||
2109 | if(found) | ||
2110 | { | ||
2111 | DetectedObject detobj = new DetectedObject(); | ||
2112 | detobj.keyUUID = av.UUID; | ||
2113 | detobj.nameStr = av.ControllingClient.Name; | ||
2114 | detobj.ownerUUID = av.UUID; | ||
2115 | detobj.posVector = av.AbsolutePosition; | ||
2116 | detobj.rotQuat = av.Rotation; | ||
2117 | detobj.velVector = av.Velocity; | ||
2118 | detobj.colliderType = 0; | ||
2119 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | ||
2120 | colliding.Add(detobj); | ||
2121 | } | ||
2122 | } | ||
2123 | |||
1983 | } | 2124 | } |
1984 | } | 2125 | } |
1985 | } | 2126 | } |
@@ -2016,18 +2157,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
2016 | if (m_parentGroup.Scene == null) | 2157 | if (m_parentGroup.Scene == null) |
2017 | return; | 2158 | return; |
2018 | SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); | 2159 | SceneObjectPart obj = m_parentGroup.Scene.GetSceneObjectPart(localId); |
2160 | string data = ""; | ||
2019 | if (obj != null) | 2161 | if (obj != null) |
2020 | { | 2162 | { |
2021 | DetectedObject detobj = new DetectedObject(); | 2163 | if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) |
2022 | detobj.keyUUID = obj.UUID; | 2164 | { |
2023 | detobj.nameStr = obj.Name; | 2165 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); |
2024 | detobj.ownerUUID = obj._ownerID; | 2166 | //If it is 1, it is to accept ONLY collisions from this object |
2025 | detobj.posVector = obj.AbsolutePosition; | 2167 | if(found) |
2026 | detobj.rotQuat = obj.GetWorldRotation(); | 2168 | { |
2027 | detobj.velVector = obj.Velocity; | 2169 | DetectedObject detobj = new DetectedObject(); |
2028 | detobj.colliderType = 0; | 2170 | detobj.keyUUID = obj.UUID; |
2029 | detobj.groupUUID = obj._groupID; | 2171 | detobj.nameStr = obj.Name; |
2030 | colliding.Add(detobj); | 2172 | detobj.ownerUUID = obj._ownerID; |
2173 | detobj.posVector = obj.AbsolutePosition; | ||
2174 | detobj.rotQuat = obj.GetWorldRotation(); | ||
2175 | detobj.velVector = obj.Velocity; | ||
2176 | detobj.colliderType = 0; | ||
2177 | detobj.groupUUID = obj._groupID; | ||
2178 | colliding.Add(detobj); | ||
2179 | } | ||
2180 | //If it is 0, it is to not accept collisions from this object | ||
2181 | else | ||
2182 | { | ||
2183 | } | ||
2184 | } | ||
2185 | else | ||
2186 | { | ||
2187 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); | ||
2188 | //If it is 1, it is to accept ONLY collisions from this object, so this other object will not work | ||
2189 | if(found) | ||
2190 | { | ||
2191 | DetectedObject detobj = new DetectedObject(); | ||
2192 | detobj.keyUUID = obj.UUID; | ||
2193 | detobj.nameStr = obj.Name; | ||
2194 | detobj.ownerUUID = obj._ownerID; | ||
2195 | detobj.posVector = obj.AbsolutePosition; | ||
2196 | detobj.rotQuat = obj.GetWorldRotation(); | ||
2197 | detobj.velVector = obj.Velocity; | ||
2198 | detobj.colliderType = 0; | ||
2199 | detobj.groupUUID = obj._groupID; | ||
2200 | colliding.Add(detobj); | ||
2201 | } | ||
2202 | } | ||
2031 | } | 2203 | } |
2032 | else | 2204 | else |
2033 | { | 2205 | { |
@@ -2039,16 +2211,47 @@ namespace OpenSim.Region.Framework.Scenes | |||
2039 | 2211 | ||
2040 | if (av.LocalId == localId) | 2212 | if (av.LocalId == localId) |
2041 | { | 2213 | { |
2042 | DetectedObject detobj = new DetectedObject(); | 2214 | if(m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.UUID.ToString()) || m_parentGroup.RootPart.CollisionFilter.ContainsValue(obj.Name)) |
2043 | detobj.keyUUID = av.UUID; | 2215 | { |
2044 | detobj.nameStr = av.Name; | 2216 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); |
2045 | detobj.ownerUUID = av.UUID; | 2217 | //If it is 1, it is to accept ONLY collisions from this avatar |
2046 | detobj.posVector = av.AbsolutePosition; | 2218 | if(found) |
2047 | detobj.rotQuat = av.Rotation; | 2219 | { |
2048 | detobj.velVector = av.Velocity; | 2220 | DetectedObject detobj = new DetectedObject(); |
2049 | detobj.colliderType = 0; | 2221 | detobj.keyUUID = av.UUID; |
2050 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | 2222 | detobj.nameStr = av.ControllingClient.Name; |
2051 | colliding.Add(detobj); | 2223 | detobj.ownerUUID = av.UUID; |
2224 | detobj.posVector = av.AbsolutePosition; | ||
2225 | detobj.rotQuat = av.Rotation; | ||
2226 | detobj.velVector = av.Velocity; | ||
2227 | detobj.colliderType = 0; | ||
2228 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | ||
2229 | colliding.Add(detobj); | ||
2230 | } | ||
2231 | //If it is 0, it is to not accept collisions from this avatar | ||
2232 | else | ||
2233 | { | ||
2234 | } | ||
2235 | } | ||
2236 | else | ||
2237 | { | ||
2238 | bool found = m_parentGroup.RootPart.CollisionFilter.TryGetValue(1,out data); | ||
2239 | //If it is 1, it is to accept ONLY collisions from this avatar, so this other avatar will not work | ||
2240 | if(found) | ||
2241 | { | ||
2242 | DetectedObject detobj = new DetectedObject(); | ||
2243 | detobj.keyUUID = av.UUID; | ||
2244 | detobj.nameStr = av.ControllingClient.Name; | ||
2245 | detobj.ownerUUID = av.UUID; | ||
2246 | detobj.posVector = av.AbsolutePosition; | ||
2247 | detobj.rotQuat = av.Rotation; | ||
2248 | detobj.velVector = av.Velocity; | ||
2249 | detobj.colliderType = 0; | ||
2250 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | ||
2251 | colliding.Add(detobj); | ||
2252 | } | ||
2253 | } | ||
2254 | |||
2052 | } | 2255 | } |
2053 | } | 2256 | } |
2054 | } | 2257 | } |