diff options
author | diva | 2009-02-15 05:00:58 +0000 |
---|---|---|
committer | diva | 2009-02-15 05:00:58 +0000 |
commit | 3d5a9e6748ef743c4db04b427d4d76ea65269618 (patch) | |
tree | 1877a66c0ca1f4caa455a7f98dd221897e687620 /OpenSim/Region/Framework | |
parent | Set sculpt map alpha to 255 prior to scaling and meshing. Addresses Mantis #3150 (diff) | |
download | opensim-SC-3d5a9e6748ef743c4db04b427d4d76ea65269618.zip opensim-SC-3d5a9e6748ef743c4db04b427d4d76ea65269618.tar.gz opensim-SC-3d5a9e6748ef743c4db04b427d4d76ea65269618.tar.bz2 opensim-SC-3d5a9e6748ef743c4db04b427d4d76ea65269618.tar.xz |
This started as way to correct Mantis #3158, which I believe should be fixed now. The flying status was temporarily being ignored, which caused the avie to drop sometimes -- there was a race condition. In the process it also fixes that annoying bug in basic physics where the avie would drop half-way to the ground upon region crossings (SetAppearance was missing). Additionally, a lot of child-agent-related code has been cleaned up; namely child agents are now consistently not added to physical scenes, and they also don't have appearances. All of that happens in MakeRoot, consistently.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 55 |
3 files changed, 35 insertions, 30 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 24cb48a..0f57b7c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2090,8 +2090,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2090 | /// <returns></returns> | 2090 | /// <returns></returns> |
2091 | protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) | 2091 | protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) |
2092 | { | 2092 | { |
2093 | AvatarAppearance appearance = null; | 2093 | AvatarAppearance appearance = new AvatarAppearance(); |
2094 | GetAvatarAppearance(client, out appearance); | 2094 | //GetAvatarAppearance(client, out appearance); |
2095 | 2095 | ||
2096 | ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); | 2096 | ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance); |
2097 | //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); | 2097 | //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID); |
@@ -2339,7 +2339,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2339 | } | 2339 | } |
2340 | 2340 | ||
2341 | // Don't disable this log message - it's too helpful | 2341 | // Don't disable this log message - it's too helpful |
2342 | m_log.DebugFormat( | 2342 | m_log.InfoFormat( |
2343 | "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", | 2343 | "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", |
2344 | RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); | 2344 | RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); |
2345 | 2345 | ||
@@ -3295,7 +3295,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3295 | } | 3295 | } |
3296 | catch (Exception e) | 3296 | catch (Exception e) |
3297 | { | 3297 | { |
3298 | m_log.Info("[BUG]: " + e.ToString()); | 3298 | m_log.Info("[BUG] in " + RegionInfo.RegionName + ": " + e.ToString()); |
3299 | } | 3299 | } |
3300 | } | 3300 | } |
3301 | } | 3301 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 2edfca8..ecce237 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -646,7 +646,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
646 | else | 646 | else |
647 | { | 647 | { |
648 | m_numRootAgents++; | 648 | m_numRootAgents++; |
649 | presence.AddToPhysicalScene(); | 649 | presence.AddToPhysicalScene(false); |
650 | } | 650 | } |
651 | 651 | ||
652 | Entities[presence.UUID] = presence; | 652 | Entities[presence.UUID] = presence; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f841707..a93fcb2 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -611,7 +611,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
611 | m_controllingClient.OnRequestWearables += SendWearables; | 611 | m_controllingClient.OnRequestWearables += SendWearables; |
612 | m_controllingClient.OnSetAppearance += SetAppearance; | 612 | m_controllingClient.OnSetAppearance += SetAppearance; |
613 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; | 613 | m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; |
614 | m_controllingClient.OnCompleteMovementToRegion += SendInitialData; | 614 | //m_controllingClient.OnCompleteMovementToRegion += SendInitialData; |
615 | m_controllingClient.OnAgentUpdate += HandleAgentUpdate; | 615 | m_controllingClient.OnAgentUpdate += HandleAgentUpdate; |
616 | m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; | 616 | m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; |
617 | m_controllingClient.OnAgentSit += HandleAgentSit; | 617 | m_controllingClient.OnAgentSit += HandleAgentSit; |
@@ -829,7 +829,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
829 | pos = emergencyPos; | 829 | pos = emergencyPos; |
830 | } | 830 | } |
831 | 831 | ||
832 | m_isChildAgent = false; | ||
833 | 832 | ||
834 | float localAVHeight = 1.56f; | 833 | float localAVHeight = 1.56f; |
835 | if (m_avHeight != 127.0f) | 834 | if (m_avHeight != 127.0f) |
@@ -845,8 +844,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
845 | } | 844 | } |
846 | AbsolutePosition = pos; | 845 | AbsolutePosition = pos; |
847 | 846 | ||
848 | AddToPhysicalScene(); | 847 | AddToPhysicalScene(isFlying); |
849 | m_physicsActor.Flying = isFlying; | 848 | SetHeight(m_appearance.AvatarHeight); |
850 | 849 | ||
851 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying | 850 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying |
852 | // avatar to return to the standing position in mid-air. On login it looks like this is being sent | 851 | // avatar to return to the standing position in mid-air. On login it looks like this is being sent |
@@ -861,13 +860,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
861 | else | 860 | else |
862 | m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); | 861 | m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); |
863 | 862 | ||
864 | //m_scene.CapsModule.AddCapsHandler(m_uuid); | ||
865 | |||
866 | // On the next prim update, all objects will be sent | 863 | // On the next prim update, all objects will be sent |
867 | // | 864 | // |
868 | m_pendingObjects = null; | 865 | m_pendingObjects = null; |
869 | 866 | ||
867 | m_isChildAgent = false; | ||
868 | |||
869 | SendInitialData(); | ||
870 | |||
870 | m_scene.EventManager.TriggerOnMakeRootAgent(this); | 871 | m_scene.EventManager.TriggerOnMakeRootAgent(this); |
872 | |||
871 | } | 873 | } |
872 | 874 | ||
873 | /// <summary> | 875 | /// <summary> |
@@ -916,10 +918,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
916 | /// <param name="pos"></param> | 918 | /// <param name="pos"></param> |
917 | public void Teleport(Vector3 pos) | 919 | public void Teleport(Vector3 pos) |
918 | { | 920 | { |
921 | bool isFlying = false; | ||
922 | if (m_physicsActor != null) | ||
923 | isFlying = m_physicsActor.Flying; | ||
924 | |||
919 | RemoveFromPhysicalScene(); | 925 | RemoveFromPhysicalScene(); |
920 | Velocity = new Vector3(0, 0, 0); | 926 | Velocity = new Vector3(0, 0, 0); |
921 | AbsolutePosition = pos; | 927 | AbsolutePosition = pos; |
922 | AddToPhysicalScene(); | 928 | AddToPhysicalScene(isFlying); |
923 | SendTerseUpdateToAllClients(); | 929 | SendTerseUpdateToAllClients(); |
924 | } | 930 | } |
925 | 931 | ||
@@ -1021,8 +1027,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1021 | if (m_isChildAgent) | 1027 | if (m_isChildAgent) |
1022 | { | 1028 | { |
1023 | m_isChildAgent = false; | 1029 | m_isChildAgent = false; |
1024 | 1030 | bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | |
1025 | MakeRootAgent(AbsolutePosition, false); | 1031 | MakeRootAgent(AbsolutePosition, m_flying); |
1026 | 1032 | ||
1027 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) | 1033 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) |
1028 | { | 1034 | { |
@@ -1068,7 +1074,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1068 | m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error# 9999903"); | 1074 | m_log.Error("[AVATAR]: NonFinite Avatar position detected... Reset Position. Mantis this please. Error# 9999903"); |
1069 | } | 1075 | } |
1070 | 1076 | ||
1071 | AddToPhysicalScene(); | 1077 | AddToPhysicalScene(false); |
1072 | } | 1078 | } |
1073 | else | 1079 | else |
1074 | { | 1080 | { |
@@ -1464,7 +1470,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1464 | 1470 | ||
1465 | if (m_physicsActor == null) | 1471 | if (m_physicsActor == null) |
1466 | { | 1472 | { |
1467 | AddToPhysicalScene(); | 1473 | AddToPhysicalScene(m_physicsActor.Flying); |
1468 | } | 1474 | } |
1469 | 1475 | ||
1470 | m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); | 1476 | m_pos += m_parentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); |
@@ -2231,7 +2237,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2231 | // just to add it back again, but it saves us from having to update | 2237 | // just to add it back again, but it saves us from having to update |
2232 | // 3 variables 10 times a second. | 2238 | // 3 variables 10 times a second. |
2233 | m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); | 2239 | m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); |
2234 | AddToPhysicalScene(); | 2240 | AddToPhysicalScene(m_physicsActor.Flying); |
2235 | } | 2241 | } |
2236 | m_appearance.SetAppearance(texture, visualParam); | 2242 | m_appearance.SetAppearance(texture, visualParam); |
2237 | SetHeight(m_appearance.AvatarHeight); | 2243 | SetHeight(m_appearance.AvatarHeight); |
@@ -2420,12 +2426,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2420 | protected void CrossToNewRegion() | 2426 | protected void CrossToNewRegion() |
2421 | { | 2427 | { |
2422 | m_inTransit = true; | 2428 | m_inTransit = true; |
2429 | |||
2430 | if ((m_physicsActor != null) && m_physicsActor.Flying) | ||
2431 | m_AgentControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
2432 | else if ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) | ||
2433 | m_AgentControlFlags &= ~(uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
2434 | |||
2423 | m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); | 2435 | m_scene.CrossAgentToNewRegion(this, m_physicsActor.Flying); |
2424 | } | 2436 | } |
2425 | 2437 | ||
2426 | public void RestoreInCurrentScene() | 2438 | public void RestoreInCurrentScene() |
2427 | { | 2439 | { |
2428 | AddToPhysicalScene(); | 2440 | AddToPhysicalScene(false); // not exactly false |
2429 | } | 2441 | } |
2430 | 2442 | ||
2431 | /// <summary> | 2443 | /// <summary> |
@@ -2583,10 +2595,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2583 | cAgent.HeadRotation = m_headrotation; | 2595 | cAgent.HeadRotation = m_headrotation; |
2584 | cAgent.BodyRotation = m_bodyRot; | 2596 | cAgent.BodyRotation = m_bodyRot; |
2585 | cAgent.ControlFlags = m_AgentControlFlags; | 2597 | cAgent.ControlFlags = m_AgentControlFlags; |
2586 | if ((m_physicsActor != null) && (m_physicsActor.Flying)) | ||
2587 | { | ||
2588 | cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
2589 | } | ||
2590 | 2598 | ||
2591 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 2599 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
2592 | cAgent.GodLevel = (byte)m_godlevel; | 2600 | cAgent.GodLevel = (byte)m_godlevel; |
@@ -2625,10 +2633,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2625 | m_headrotation = cAgent.HeadRotation; | 2633 | m_headrotation = cAgent.HeadRotation; |
2626 | m_bodyRot = cAgent.BodyRotation; | 2634 | m_bodyRot = cAgent.BodyRotation; |
2627 | m_AgentControlFlags = cAgent.ControlFlags; // We need more flags! | 2635 | m_AgentControlFlags = cAgent.ControlFlags; // We need more flags! |
2628 | if (m_physicsActor != null) | 2636 | |
2629 | { | ||
2630 | m_physicsActor.Flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | ||
2631 | } | ||
2632 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) | 2637 | if (m_scene.Permissions.IsGod(new UUID(cAgent.AgentID))) |
2633 | m_godlevel = cAgent.GodLevel; | 2638 | m_godlevel = cAgent.GodLevel; |
2634 | m_setAlwaysRun = cAgent.AlwaysRun; | 2639 | m_setAlwaysRun = cAgent.AlwaysRun; |
@@ -2755,7 +2760,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2755 | /// <summary> | 2760 | /// <summary> |
2756 | /// Adds a physical representation of the avatar to the Physics plugin | 2761 | /// Adds a physical representation of the avatar to the Physics plugin |
2757 | /// </summary> | 2762 | /// </summary> |
2758 | public void AddToPhysicalScene() | 2763 | public void AddToPhysicalScene(bool isFlying) |
2759 | { | 2764 | { |
2760 | PhysicsScene scene = m_scene.PhysicsScene; | 2765 | PhysicsScene scene = m_scene.PhysicsScene; |
2761 | 2766 | ||
@@ -2765,13 +2770,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2765 | 2770 | ||
2766 | if (m_avHeight == 127.0f) | 2771 | if (m_avHeight == 127.0f) |
2767 | { | 2772 | { |
2768 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f)); | 2773 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), isFlying); |
2769 | } | 2774 | } |
2770 | else | 2775 | else |
2771 | { | 2776 | { |
2772 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight)); | 2777 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, m_avHeight), isFlying); |
2773 | } | 2778 | } |
2774 | 2779 | ||
2775 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 2780 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
2776 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 2781 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |
2777 | m_physicsActor.SubscribeEvents(1000); | 2782 | m_physicsActor.SubscribeEvents(1000); |