diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 105 |
1 files changed, 69 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 96a3425..87207a0 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -870,14 +870,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
870 | { | 870 | { |
871 | if (PhysicsActor != null) | 871 | if (PhysicsActor != null) |
872 | { | 872 | { |
873 | lock (m_scene.SyncRoot) | 873 | m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; |
874 | { | 874 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); |
875 | m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; | 875 | m_physicsActor.UnSubscribeEvents(); |
876 | m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); | 876 | m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; |
877 | m_physicsActor.UnSubscribeEvents(); | 877 | PhysicsActor = null; |
878 | m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; | ||
879 | PhysicsActor = null; | ||
880 | } | ||
881 | } | 878 | } |
882 | } | 879 | } |
883 | 880 | ||
@@ -999,7 +996,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
999 | internal void SetHeight(float height) | 996 | internal void SetHeight(float height) |
1000 | { | 997 | { |
1001 | m_avHeight = height; | 998 | m_avHeight = height; |
1002 | if (PhysicsActor != null) | 999 | if (PhysicsActor != null && !IsChildAgent) |
1003 | { | 1000 | { |
1004 | PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight); | 1001 | PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight); |
1005 | PhysicsActor.Size = SetSize; | 1002 | PhysicsActor.Size = SetSize; |
@@ -2219,7 +2216,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
2219 | { | 2216 | { |
2220 | if (m_isChildAgent) | 2217 | if (m_isChildAgent) |
2221 | { | 2218 | { |
2222 | m_log.Debug("DEBUG: AddNewMovement: child agent"); | 2219 | m_log.Debug("DEBUG: AddNewMovement: child agent, Making root agent!"); |
2220 | |||
2221 | // we have to reset the user's child agent connections. | ||
2222 | // Likely, here they've lost the eventqueue for other regions so border | ||
2223 | // crossings will fail at this point unless we reset them. | ||
2224 | |||
2225 | List<ulong> regions = new List<ulong>(KnownChildRegionHandles); | ||
2226 | regions.Remove(m_scene.RegionInfo.RegionHandle); | ||
2227 | |||
2228 | MakeRootAgent(new Vector3(127, 127, 127), true); | ||
2229 | |||
2230 | // Async command | ||
2231 | if (m_scene.SceneGridService != null) | ||
2232 | { | ||
2233 | m_scene.SceneGridService.SendCloseChildAgentConnections(UUID, regions); | ||
2234 | |||
2235 | // Give the above command some time to try and close the connections. | ||
2236 | // this is really an emergency.. so sleep, or we'll get all discombobulated. | ||
2237 | System.Threading.Thread.Sleep(500); | ||
2238 | } | ||
2239 | |||
2240 | |||
2241 | if (m_scene.SceneGridService != null) | ||
2242 | { | ||
2243 | m_scene.SceneGridService.EnableNeighbourChildAgents(this, new List<RegionInfo>()); | ||
2244 | } | ||
2245 | |||
2246 | |||
2247 | |||
2223 | return; | 2248 | return; |
2224 | } | 2249 | } |
2225 | 2250 | ||
@@ -2554,11 +2579,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2554 | { | 2579 | { |
2555 | if (m_physicsActor != null) | 2580 | if (m_physicsActor != null) |
2556 | { | 2581 | { |
2557 | // This may seem like it's redundant, remove the avatar from the physics scene | 2582 | if (!IsChildAgent) |
2558 | // just to add it back again, but it saves us from having to update | 2583 | { |
2559 | // 3 variables 10 times a second. | 2584 | // This may seem like it's redundant, remove the avatar from the physics scene |
2560 | m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); | 2585 | // just to add it back again, but it saves us from having to update |
2561 | AddToPhysicalScene(m_physicsActor.Flying); | 2586 | // 3 variables 10 times a second. |
2587 | bool flyingTemp = m_physicsActor.Flying; | ||
2588 | RemoveFromPhysicalScene(); | ||
2589 | //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); | ||
2590 | |||
2591 | //PhysicsActor = null; | ||
2592 | |||
2593 | AddToPhysicalScene(flyingTemp); | ||
2594 | } | ||
2562 | } | 2595 | } |
2563 | m_appearance.SetAppearance(texture, visualParam); | 2596 | m_appearance.SetAppearance(texture, visualParam); |
2564 | if (m_appearance.AvatarHeight > 0) | 2597 | if (m_appearance.AvatarHeight > 0) |
@@ -3188,30 +3221,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
3188 | /// </summary> | 3221 | /// </summary> |
3189 | public void AddToPhysicalScene(bool isFlying) | 3222 | public void AddToPhysicalScene(bool isFlying) |
3190 | { | 3223 | { |
3191 | lock (m_scene.SyncRoot) | 3224 | |
3192 | { | 3225 | PhysicsScene scene = m_scene.PhysicsScene; |
3193 | PhysicsScene scene = m_scene.PhysicsScene; | ||
3194 | 3226 | ||
3195 | PhysicsVector pVec = | 3227 | PhysicsVector pVec = |
3196 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, | 3228 | new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, |
3197 | AbsolutePosition.Z); | 3229 | AbsolutePosition.Z); |
3198 | 3230 | ||
3199 | if (m_avHeight == 127.0f) | 3231 | // Old bug where the height was in centimeters instead of meters |
3200 | { | 3232 | if (m_avHeight == 127.0f) |
3201 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), | 3233 | { |
3202 | isFlying); | 3234 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), |
3203 | } | 3235 | isFlying); |
3204 | else | ||
3205 | { | ||
3206 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, | ||
3207 | new PhysicsVector(0, 0, m_avHeight), isFlying); | ||
3208 | } | ||
3209 | scene.AddPhysicsActorTaint(m_physicsActor); | ||
3210 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | ||
3211 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | ||
3212 | m_physicsActor.SubscribeEvents(1000); | ||
3213 | m_physicsActor.LocalID = LocalId; | ||
3214 | } | 3236 | } |
3237 | else | ||
3238 | { | ||
3239 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, | ||
3240 | new PhysicsVector(0, 0, m_avHeight), isFlying); | ||
3241 | } | ||
3242 | scene.AddPhysicsActorTaint(m_physicsActor); | ||
3243 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | ||
3244 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | ||
3245 | m_physicsActor.SubscribeEvents(1000); | ||
3246 | m_physicsActor.LocalID = LocalId; | ||
3247 | |||
3215 | } | 3248 | } |
3216 | 3249 | ||
3217 | // Event called by the physics plugin to tell the avatar about a collision. | 3250 | // Event called by the physics plugin to tell the avatar about a collision. |