diff options
author | teravus | 2012-12-19 11:53:26 -0500 |
---|---|---|
committer | teravus | 2012-12-19 11:53:26 -0500 |
commit | c648325d7c761beb2ebe0edff3a70fdfbc81ffdb (patch) | |
tree | 831779e20f7c21037d2bfcb4dc1985412c364e6b /OpenSim/Region/Framework/Scenes | |
parent | * This is a better way to do the last commit. (diff) | |
parent | Add the interfaces for the new Avination baked texture cache service (diff) | |
download | opensim-SC_OLD-c648325d7c761beb2ebe0edff3a70fdfbc81ffdb.zip opensim-SC_OLD-c648325d7c761beb2ebe0edff3a70fdfbc81ffdb.tar.gz opensim-SC_OLD-c648325d7c761beb2ebe0edff3a70fdfbc81ffdb.tar.bz2 opensim-SC_OLD-c648325d7c761beb2ebe0edff3a70fdfbc81ffdb.tar.xz |
Merge branch 'avination' of careminster:/var/git/careminster into teravuswork
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 288 |
2 files changed, 110 insertions, 182 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b9f9c86..4ad8b11 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3449,7 +3449,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3449 | part.ClonePermissions(RootPart); | 3449 | part.ClonePermissions(RootPart); |
3450 | }); | 3450 | }); |
3451 | 3451 | ||
3452 | RootPart.OwnerMask = newOwnerMask | foldedPerms; | 3452 | uint lockMask = ~(uint)PermissionMask.Move; |
3453 | uint lockBit = RootPart.OwnerMask & (uint)PermissionMask.Move; | ||
3454 | RootPart.OwnerMask = (RootPart.OwnerMask & lockBit) | ((newOwnerMask | foldedPerms) & lockMask); | ||
3453 | RootPart.ScheduleFullUpdate(); | 3455 | RootPart.ScheduleFullUpdate(); |
3454 | } | 3456 | } |
3455 | 3457 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index bacc9c9..7ff163b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -140,6 +140,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | private Vector3 m_lastPosition; | 140 | private Vector3 m_lastPosition; |
141 | private Quaternion m_lastRotation; | 141 | private Quaternion m_lastRotation; |
142 | private Vector3 m_lastVelocity; | 142 | private Vector3 m_lastVelocity; |
143 | private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); | ||
144 | |||
143 | 145 | ||
144 | private Vector3? m_forceToApply; | 146 | private Vector3? m_forceToApply; |
145 | private int m_userFlags; | 147 | private int m_userFlags; |
@@ -562,7 +564,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
562 | // Scene.RegionInfo.RegionName, Name, m_velocity); | 564 | // Scene.RegionInfo.RegionName, Name, m_velocity); |
563 | } | 565 | } |
564 | } | 566 | } |
567 | /* | ||
568 | public override Vector3 AngularVelocity | ||
569 | { | ||
570 | get | ||
571 | { | ||
572 | if (PhysicsActor != null) | ||
573 | { | ||
574 | m_rotationalvelocity = PhysicsActor.RotationalVelocity; | ||
575 | |||
576 | // m_log.DebugFormat( | ||
577 | // "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!", | ||
578 | // m_velocity, Name, Scene.RegionInfo.RegionName); | ||
579 | } | ||
565 | 580 | ||
581 | return m_rotationalvelocity; | ||
582 | } | ||
583 | } | ||
584 | */ | ||
566 | private Quaternion m_bodyRot = Quaternion.Identity; | 585 | private Quaternion m_bodyRot = Quaternion.Identity; |
567 | 586 | ||
568 | public Quaternion Rotation | 587 | public Quaternion Rotation |
@@ -1260,6 +1279,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1260 | PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); | 1279 | PhysicsActor.Size = new Vector3(0.45f, 0.6f, height); |
1261 | } | 1280 | } |
1262 | 1281 | ||
1282 | public void SetSize(Vector3 size, float feetoffset) | ||
1283 | { | ||
1284 | if (PhysicsActor != null && !IsChildAgent) | ||
1285 | PhysicsActor.setAvatarSize(size, feetoffset); | ||
1286 | |||
1287 | } | ||
1288 | |||
1263 | /// <summary> | 1289 | /// <summary> |
1264 | /// Complete Avatar's movement into the region. | 1290 | /// Complete Avatar's movement into the region. |
1265 | /// </summary> | 1291 | /// </summary> |
@@ -2077,12 +2103,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
2077 | } | 2103 | } |
2078 | else | 2104 | else |
2079 | { | 2105 | { |
2080 | if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) | 2106 | // if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) |
2081 | { | 2107 | // { |
2082 | // m_log.DebugFormat( | 2108 | // m_log.DebugFormat( |
2083 | // "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is unset and within 10m", | 2109 | // "[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is unset and within 10m", |
2084 | // Name, part.Name, part.LocalId); | 2110 | // Name, part.Name, part.LocalId); |
2085 | 2111 | ||
2112 | if (m_scene.PhysicsScene != null && | ||
2113 | part.PhysActor != null && | ||
2114 | Util.GetDistanceTo(AbsolutePosition, pos) <= 30) | ||
2115 | { | ||
2116 | |||
2117 | Vector3 camdif = CameraPosition - part.AbsolutePosition; | ||
2118 | camdif.Normalize(); | ||
2119 | |||
2120 | // m_log.InfoFormat("sit {0} {1}", offset.ToString(), camdif.ToString()); | ||
2121 | |||
2122 | if (m_scene.PhysicsScene.SitAvatar(part.PhysActor, AbsolutePosition, CameraPosition, offset, new Vector3(0.35f, 0, 0.65f), PhysicsSitResponse) != 0) | ||
2123 | return; | ||
2124 | } | ||
2125 | |||
2126 | if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10) | ||
2127 | { | ||
2128 | |||
2086 | AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); | 2129 | AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight); |
2087 | canSit = true; | 2130 | canSit = true; |
2088 | } | 2131 | } |
@@ -2170,197 +2213,54 @@ namespace OpenSim.Region.Framework.Scenes | |||
2170 | SendSitResponse(targetID, offset, Quaternion.Identity); | 2213 | SendSitResponse(targetID, offset, Quaternion.Identity); |
2171 | } | 2214 | } |
2172 | 2215 | ||
2173 | /* | 2216 | public void PhysicsSitResponse(int status, uint partID, Vector3 offset, Quaternion Orientation) |
2174 | public void SitRayCastAvatarPosition(SceneObjectPart part) | ||
2175 | { | 2217 | { |
2176 | Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset; | ||
2177 | Vector3 StartRayCastPosition = AbsolutePosition; | ||
2178 | Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition); | ||
2179 | float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition); | ||
2180 | m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastAvatarPositionResponse); | ||
2181 | } | ||
2182 | 2218 | ||
2183 | public void SitRayCastAvatarPositionResponse(bool hitYN, Vector3 collisionPoint, uint localid, float pdistance, Vector3 normal) | 2219 | if (status < 0) |
2184 | { | ||
2185 | SceneObjectPart part = FindNextAvailableSitTarget(m_requestedSitTargetUUID); | ||
2186 | if (part != null) | ||
2187 | { | ||
2188 | if (hitYN) | ||
2189 | { | ||
2190 | if (collisionPoint.ApproxEquals(m_requestedSitOffset + part.AbsolutePosition, 0.2f)) | ||
2191 | { | ||
2192 | SitRaycastFindEdge(collisionPoint, normal); | ||
2193 | m_log.DebugFormat("[SIT]: Raycast Avatar Position succeeded at point: {0}, normal:{1}", collisionPoint, normal); | ||
2194 | } | ||
2195 | else | ||
2196 | { | ||
2197 | SitRayCastAvatarPositionCameraZ(part); | ||
2198 | } | ||
2199 | } | ||
2200 | else | ||
2201 | { | ||
2202 | SitRayCastAvatarPositionCameraZ(part); | ||
2203 | } | ||
2204 | } | ||
2205 | else | ||
2206 | { | 2220 | { |
2207 | ControllingClient.SendAlertMessage("Sit position no longer exists"); | 2221 | ControllingClient.SendAlertMessage("Sit position no longer exists"); |
2208 | m_requestedSitTargetUUID = UUID.Zero; | 2222 | return; |
2209 | m_requestedSitTargetID = 0; | ||
2210 | m_requestedSitOffset = Vector3.Zero; | ||
2211 | } | 2223 | } |
2212 | 2224 | ||
2213 | } | 2225 | if (status == 0) |
2214 | 2226 | return; | |
2215 | public void SitRayCastAvatarPositionCameraZ(SceneObjectPart part) | ||
2216 | { | ||
2217 | // Next, try to raycast from the camera Z position | ||
2218 | Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset; | ||
2219 | Vector3 StartRayCastPosition = AbsolutePosition; StartRayCastPosition.Z = CameraPosition.Z; | ||
2220 | Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition); | ||
2221 | float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition); | ||
2222 | m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastAvatarPositionCameraZResponse); | ||
2223 | } | ||
2224 | 2227 | ||
2225 | public void SitRayCastAvatarPositionCameraZResponse(bool hitYN, Vector3 collisionPoint, uint localid, float pdistance, Vector3 normal) | 2228 | SceneObjectPart part = m_scene.GetSceneObjectPart(partID); |
2226 | { | 2229 | if (part == null || part.ParentGroup.IsAttachment) |
2227 | SceneObjectPart part = FindNextAvailableSitTarget(m_requestedSitTargetUUID); | ||
2228 | if (part != null) | ||
2229 | { | 2230 | { |
2230 | if (hitYN) | 2231 | return; |
2231 | { | ||
2232 | if (collisionPoint.ApproxEquals(m_requestedSitOffset + part.AbsolutePosition, 0.2f)) | ||
2233 | { | ||
2234 | SitRaycastFindEdge(collisionPoint, normal); | ||
2235 | m_log.DebugFormat("[SIT]: Raycast Avatar Position + CameraZ succeeded at point: {0}, normal:{1}", collisionPoint, normal); | ||
2236 | } | ||
2237 | else | ||
2238 | { | ||
2239 | SitRayCastCameraPosition(part); | ||
2240 | } | ||
2241 | } | ||
2242 | else | ||
2243 | { | ||
2244 | SitRayCastCameraPosition(part); | ||
2245 | } | ||
2246 | } | ||
2247 | else | ||
2248 | { | ||
2249 | ControllingClient.SendAlertMessage("Sit position no longer exists"); | ||
2250 | m_requestedSitTargetUUID = UUID.Zero; | ||
2251 | m_requestedSitTargetID = 0; | ||
2252 | m_requestedSitOffset = Vector3.Zero; | ||
2253 | } | 2232 | } |
2254 | 2233 | ||
2255 | } | 2234 | // m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString()); |
2256 | 2235 | ||
2257 | public void SitRayCastCameraPosition(SceneObjectPart part) | 2236 | part.AddSittingAvatar(UUID); |
2258 | { | ||
2259 | // Next, try to raycast from the camera position | ||
2260 | Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset; | ||
2261 | Vector3 StartRayCastPosition = CameraPosition; | ||
2262 | Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition); | ||
2263 | float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition); | ||
2264 | m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastCameraPositionResponse); | ||
2265 | } | ||
2266 | 2237 | ||
2267 | public void SitRayCastCameraPositionResponse(bool hitYN, Vector3 collisionPoint, uint localid, float pdistance, Vector3 normal) | 2238 | Vector3 cameraAtOffset = part.GetCameraAtOffset(); |
2268 | { | 2239 | Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); |
2269 | SceneObjectPart part = FindNextAvailableSitTarget(m_requestedSitTargetUUID); | 2240 | bool forceMouselook = part.GetForceMouselook(); |
2270 | if (part != null) | ||
2271 | { | ||
2272 | if (hitYN) | ||
2273 | { | ||
2274 | if (collisionPoint.ApproxEquals(m_requestedSitOffset + part.AbsolutePosition, 0.2f)) | ||
2275 | { | ||
2276 | SitRaycastFindEdge(collisionPoint, normal); | ||
2277 | m_log.DebugFormat("[SIT]: Raycast Camera Position succeeded at point: {0}, normal:{1}", collisionPoint, normal); | ||
2278 | } | ||
2279 | else | ||
2280 | { | ||
2281 | SitRayHorizontal(part); | ||
2282 | } | ||
2283 | } | ||
2284 | else | ||
2285 | { | ||
2286 | SitRayHorizontal(part); | ||
2287 | } | ||
2288 | } | ||
2289 | else | ||
2290 | { | ||
2291 | ControllingClient.SendAlertMessage("Sit position no longer exists"); | ||
2292 | m_requestedSitTargetUUID = UUID.Zero; | ||
2293 | m_requestedSitTargetID = 0; | ||
2294 | m_requestedSitOffset = Vector3.Zero; | ||
2295 | } | ||
2296 | 2241 | ||
2297 | } | 2242 | ControllingClient.SendSitResponse( |
2243 | part.UUID, offset, Orientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook); | ||
2298 | 2244 | ||
2299 | public void SitRayHorizontal(SceneObjectPart part) | 2245 | part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); |
2300 | { | ||
2301 | // Next, try to raycast from the avatar position to fwd | ||
2302 | Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset; | ||
2303 | Vector3 StartRayCastPosition = CameraPosition; | ||
2304 | Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition); | ||
2305 | float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition); | ||
2306 | m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastHorizontalResponse); | ||
2307 | } | ||
2308 | 2246 | ||
2309 | public void SitRayCastHorizontalResponse(bool hitYN, Vector3 collisionPoint, uint localid, float pdistance, Vector3 normal) | 2247 | // assuming no autopilot in use |
2310 | { | 2248 | Velocity = Vector3.Zero; |
2311 | SceneObjectPart part = FindNextAvailableSitTarget(m_requestedSitTargetUUID); | 2249 | RemoveFromPhysicalScene(); |
2312 | if (part != null) | ||
2313 | { | ||
2314 | if (hitYN) | ||
2315 | { | ||
2316 | if (collisionPoint.ApproxEquals(m_requestedSitOffset + part.AbsolutePosition, 0.2f)) | ||
2317 | { | ||
2318 | SitRaycastFindEdge(collisionPoint, normal); | ||
2319 | m_log.DebugFormat("[SIT]: Raycast Horizontal Position succeeded at point: {0}, normal:{1}", collisionPoint, normal); | ||
2320 | // Next, try to raycast from the camera position | ||
2321 | Vector3 EndRayCastPosition = part.AbsolutePosition + m_requestedSitOffset; | ||
2322 | Vector3 StartRayCastPosition = CameraPosition; | ||
2323 | Vector3 direction = Vector3.Normalize(EndRayCastPosition - StartRayCastPosition); | ||
2324 | float distance = Vector3.Distance(EndRayCastPosition, StartRayCastPosition); | ||
2325 | //m_scene.PhysicsScene.RaycastWorld(StartRayCastPosition, direction, distance, SitRayCastResponseAvatarPosition); | ||
2326 | } | ||
2327 | else | ||
2328 | { | ||
2329 | ControllingClient.SendAlertMessage("Sit position not accessable."); | ||
2330 | m_requestedSitTargetUUID = UUID.Zero; | ||
2331 | m_requestedSitTargetID = 0; | ||
2332 | m_requestedSitOffset = Vector3.Zero; | ||
2333 | } | ||
2334 | } | ||
2335 | else | ||
2336 | { | ||
2337 | ControllingClient.SendAlertMessage("Sit position not accessable."); | ||
2338 | m_requestedSitTargetUUID = UUID.Zero; | ||
2339 | m_requestedSitTargetID = 0; | ||
2340 | m_requestedSitOffset = Vector3.Zero; | ||
2341 | } | ||
2342 | } | ||
2343 | else | ||
2344 | { | ||
2345 | ControllingClient.SendAlertMessage("Sit position no longer exists"); | ||
2346 | m_requestedSitTargetUUID = UUID.Zero; | ||
2347 | m_requestedSitTargetID = 0; | ||
2348 | m_requestedSitOffset = Vector3.Zero; | ||
2349 | } | ||
2350 | 2250 | ||
2351 | } | 2251 | Rotation = Orientation; |
2252 | m_pos = offset; | ||
2352 | 2253 | ||
2353 | private void SitRaycastFindEdge(Vector3 collisionPoint, Vector3 collisionNormal) | 2254 | m_requestedSitTargetID = 0; // invalidate the viewer sit comand for now |
2354 | { | 2255 | part.ParentGroup.AddAvatar(UUID); |
2355 | int i = 0; | 2256 | |
2356 | //throw new NotImplementedException(); | 2257 | ParentPart = part; |
2357 | //m_requestedSitTargetUUID = UUID.Zero; | 2258 | ParentID = part.LocalId; |
2358 | //m_requestedSitTargetID = 0; | ||
2359 | //m_requestedSitOffset = Vector3.Zero; | ||
2360 | 2259 | ||
2361 | SendSitResponse(ControllingClient, m_requestedSitTargetUUID, collisionPoint - m_requestedSitOffset, Quaternion.Identity); | 2260 | Animator.TrySetMovementAnimation("SIT"); |
2261 | SendAvatarDataToAllAgents(); | ||
2362 | } | 2262 | } |
2363 | */ | 2263 | |
2364 | 2264 | ||
2365 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) | 2265 | public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) |
2366 | { | 2266 | { |
@@ -2566,9 +2466,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2566 | // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to | 2466 | // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to |
2567 | // grab the latest PhysicsActor velocity, whereas m_velocity is often | 2467 | // grab the latest PhysicsActor velocity, whereas m_velocity is often |
2568 | // storing a requested force instead of an actual traveling velocity | 2468 | // storing a requested force instead of an actual traveling velocity |
2469 | if (Appearance.AvatarSize != m_lastSize) | ||
2470 | { | ||
2471 | m_lastSize = Appearance.AvatarSize; | ||
2472 | SendAvatarDataToAllAgents(); | ||
2473 | } | ||
2569 | 2474 | ||
2570 | // Throw away duplicate or insignificant updates | 2475 | else if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || |
2571 | if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | ||
2572 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 2476 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || |
2573 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | 2477 | !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) |
2574 | { | 2478 | { |
@@ -2866,6 +2770,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2866 | 2770 | ||
2867 | avatar.ControllingClient.SendAppearance( | 2771 | avatar.ControllingClient.SendAppearance( |
2868 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); | 2772 | UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); |
2773 | |||
2774 | |||
2869 | } | 2775 | } |
2870 | 2776 | ||
2871 | #endregion | 2777 | #endregion |
@@ -3438,15 +3344,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3438 | } | 3344 | } |
3439 | 3345 | ||
3440 | if (Appearance.AvatarHeight == 0) | 3346 | if (Appearance.AvatarHeight == 0) |
3441 | Appearance.SetHeight(); | 3347 | // Appearance.SetHeight(); |
3348 | Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); | ||
3442 | 3349 | ||
3443 | PhysicsScene scene = m_scene.PhysicsScene; | 3350 | PhysicsScene scene = m_scene.PhysicsScene; |
3444 | 3351 | ||
3445 | Vector3 pVec = AbsolutePosition; | 3352 | Vector3 pVec = AbsolutePosition; |
3446 | 3353 | ||
3354 | /* | ||
3447 | PhysicsActor = scene.AddAvatar( | 3355 | PhysicsActor = scene.AddAvatar( |
3448 | LocalId, Firstname + "." + Lastname, pVec, | 3356 | LocalId, Firstname + "." + Lastname, pVec, |
3449 | new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); | 3357 | new Vector3(0.45f, 0.6f, Appearance.AvatarHeight), isFlying); |
3358 | */ | ||
3359 | |||
3360 | PhysicsActor = scene.AddAvatar( | ||
3361 | LocalId, Firstname + "." + Lastname, pVec, | ||
3362 | Appearance.AvatarBoxSize,Appearance.AvatarFeetOffset, isFlying); | ||
3450 | 3363 | ||
3451 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 3364 | //PhysicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
3452 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 3365 | PhysicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
@@ -3465,6 +3378,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3465 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); | 3378 | ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); |
3466 | } | 3379 | } |
3467 | 3380 | ||
3381 | |||
3468 | /// <summary> | 3382 | /// <summary> |
3469 | /// Event called by the physics plugin to tell the avatar about a collision. | 3383 | /// Event called by the physics plugin to tell the avatar about a collision. |
3470 | /// </summary> | 3384 | /// </summary> |
@@ -3494,7 +3408,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3494 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; | 3408 | CollisionEventUpdate collisionData = (CollisionEventUpdate)e; |
3495 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; | 3409 | Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; |
3496 | 3410 | ||
3497 | CollisionPlane = Vector4.UnitW; | ||
3498 | 3411 | ||
3499 | // // No collisions at all means we may be flying. Update always | 3412 | // // No collisions at all means we may be flying. Update always |
3500 | // // to make falling work | 3413 | // // to make falling work |
@@ -3506,6 +3419,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3506 | 3419 | ||
3507 | if (coldata.Count != 0) | 3420 | if (coldata.Count != 0) |
3508 | { | 3421 | { |
3422 | /* | ||
3509 | switch (Animator.CurrentMovementAnimation) | 3423 | switch (Animator.CurrentMovementAnimation) |
3510 | { | 3424 | { |
3511 | case "STAND": | 3425 | case "STAND": |
@@ -3514,24 +3428,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
3514 | case "CROUCH": | 3428 | case "CROUCH": |
3515 | case "CROUCHWALK": | 3429 | case "CROUCHWALK": |
3516 | { | 3430 | { |
3431 | */ | ||
3517 | ContactPoint lowest; | 3432 | ContactPoint lowest; |
3518 | lowest.SurfaceNormal = Vector3.Zero; | 3433 | lowest.SurfaceNormal = Vector3.Zero; |
3519 | lowest.Position = Vector3.Zero; | 3434 | lowest.Position = Vector3.Zero; |
3520 | lowest.Position.Z = Single.NaN; | 3435 | lowest.Position.Z = float.MaxValue; |
3521 | 3436 | ||
3522 | foreach (ContactPoint contact in coldata.Values) | 3437 | foreach (ContactPoint contact in coldata.Values) |
3523 | { | 3438 | { |
3524 | if (Single.IsNaN(lowest.Position.Z) || contact.Position.Z < lowest.Position.Z) | 3439 | |
3440 | if (contact.CharacterFeet && contact.Position.Z < lowest.Position.Z) | ||
3525 | { | 3441 | { |
3526 | lowest = contact; | 3442 | lowest = contact; |
3527 | } | 3443 | } |
3528 | } | 3444 | } |
3529 | 3445 | ||
3530 | CollisionPlane = new Vector4(-lowest.SurfaceNormal, -Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); | 3446 | if (lowest.Position.Z != float.MaxValue) |
3447 | { | ||
3448 | lowest.SurfaceNormal = -lowest.SurfaceNormal; | ||
3449 | CollisionPlane = new Vector4(lowest.SurfaceNormal, Vector3.Dot(lowest.Position, lowest.SurfaceNormal)); | ||
3450 | } | ||
3451 | else | ||
3452 | CollisionPlane = Vector4.UnitW; | ||
3453 | /* | ||
3531 | } | 3454 | } |
3532 | break; | 3455 | break; |
3533 | } | 3456 | } |
3457 | */ | ||
3534 | } | 3458 | } |
3459 | else | ||
3460 | CollisionPlane = Vector4.UnitW; | ||
3535 | 3461 | ||
3536 | RaiseCollisionScriptEvents(coldata); | 3462 | RaiseCollisionScriptEvents(coldata); |
3537 | 3463 | ||