diff options
author | Melanie | 2010-11-02 22:58:33 +0000 |
---|---|---|
committer | Melanie | 2010-11-02 22:58:33 +0000 |
commit | 26f12f479f17aef37451fb30f9b1de376c8676ac (patch) | |
tree | ecaf084da6ca491301450c0f8a8460a8b1dc981a /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
parent | Fix default club feet (diff) | |
download | opensim-SC-26f12f479f17aef37451fb30f9b1de376c8676ac.zip opensim-SC-26f12f479f17aef37451fb30f9b1de376c8676ac.tar.gz opensim-SC-26f12f479f17aef37451fb30f9b1de376c8676ac.tar.bz2 opensim-SC-26f12f479f17aef37451fb30f9b1de376c8676ac.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 98 |
1 files changed, 50 insertions, 48 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index dafc1af..2a48be9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -177,7 +177,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
177 | private float m_health = 100f; | 177 | private float m_health = 100f; |
178 | 178 | ||
179 | // Default AV Height | 179 | // Default AV Height |
180 | private float m_avHeight = 127.0f; | ||
181 | 180 | ||
182 | protected RegionInfo m_regionInfo; | 181 | protected RegionInfo m_regionInfo; |
183 | protected ulong crossingFromRegion; | 182 | protected ulong crossingFromRegion; |
@@ -974,9 +973,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
974 | } | 973 | } |
975 | 974 | ||
976 | float localAVHeight = 1.56f; | 975 | float localAVHeight = 1.56f; |
977 | if (m_avHeight != 127.0f) | 976 | if (m_appearance != null) |
978 | { | 977 | { |
979 | localAVHeight = m_avHeight; | 978 | if (m_appearance.AvatarHeight > 0) |
979 | localAVHeight = m_appearance.AvatarHeight; | ||
980 | } | 980 | } |
981 | 981 | ||
982 | float posZLimit = 0; | 982 | float posZLimit = 0; |
@@ -991,17 +991,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
991 | } | 991 | } |
992 | AbsolutePosition = pos; | 992 | AbsolutePosition = pos; |
993 | 993 | ||
994 | AddToPhysicalScene(isFlying); | ||
995 | |||
996 | if (m_forceFly) | ||
997 | { | ||
998 | m_physicsActor.Flying = true; | ||
999 | } | ||
1000 | else if (m_flyDisabled) | ||
1001 | { | ||
1002 | m_physicsActor.Flying = false; | ||
1003 | } | ||
1004 | |||
1005 | if (m_appearance != null) | 994 | if (m_appearance != null) |
1006 | { | 995 | { |
1007 | if (m_appearance.AvatarHeight > 0) | 996 | if (m_appearance.AvatarHeight > 0) |
@@ -1014,6 +1003,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
1014 | m_appearance = new AvatarAppearance(UUID); | 1003 | m_appearance = new AvatarAppearance(UUID); |
1015 | } | 1004 | } |
1016 | 1005 | ||
1006 | AddToPhysicalScene(isFlying); | ||
1007 | |||
1008 | if (m_appearance != null) | ||
1009 | { | ||
1010 | if (m_appearance.AvatarHeight > 0) | ||
1011 | SetHeight(m_appearance.AvatarHeight); | ||
1012 | } | ||
1013 | |||
1014 | if (m_forceFly) | ||
1015 | { | ||
1016 | m_physicsActor.Flying = true; | ||
1017 | } | ||
1018 | else if (m_flyDisabled) | ||
1019 | { | ||
1020 | m_physicsActor.Flying = false; | ||
1021 | } | ||
1022 | |||
1017 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying | 1023 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying |
1018 | // avatar to return to the standing position in mid-air. On login it looks like this is being sent | 1024 | // avatar to return to the standing position in mid-air. On login it looks like this is being sent |
1019 | // elsewhere anyway | 1025 | // elsewhere anyway |
@@ -1200,10 +1206,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1200 | /// </summary> | 1206 | /// </summary> |
1201 | public void SetHeight(float height) | 1207 | public void SetHeight(float height) |
1202 | { | 1208 | { |
1203 | m_avHeight = height; | ||
1204 | if (PhysicsActor != null && !IsChildAgent) | 1209 | if (PhysicsActor != null && !IsChildAgent) |
1205 | { | 1210 | { |
1206 | Vector3 SetSize = new Vector3(0.45f, 0.6f, m_avHeight); | 1211 | Vector3 SetSize = new Vector3(0.45f, 0.6f, height); |
1207 | PhysicsActor.Size = SetSize; | 1212 | PhysicsActor.Size = SetSize; |
1208 | } | 1213 | } |
1209 | } | 1214 | } |
@@ -1215,9 +1220,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1215 | /// </summary> | 1220 | /// </summary> |
1216 | public void CompleteMovement(IClientAPI client) | 1221 | public void CompleteMovement(IClientAPI client) |
1217 | { | 1222 | { |
1218 | // DEBUG ON | 1223 | DateTime startTime = DateTime.Now; |
1219 | m_log.WarnFormat("[SCENE PRESENCE]: CompleteMovement for {0}",UUID); | 1224 | |
1220 | // DEBUG OFF | 1225 | m_log.DebugFormat( |
1226 | "[SCENE PRESENCE]: Completing movement of {0} into region {1}", | ||
1227 | client.Name, Scene.RegionInfo.RegionName); | ||
1221 | 1228 | ||
1222 | Vector3 look = Velocity; | 1229 | Vector3 look = Velocity; |
1223 | if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) | 1230 | if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) |
@@ -1264,6 +1271,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1264 | if (friendsModule != null) | 1271 | if (friendsModule != null) |
1265 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); | 1272 | friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); |
1266 | } | 1273 | } |
1274 | |||
1275 | m_log.DebugFormat( | ||
1276 | "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", | ||
1277 | client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); | ||
1267 | } | 1278 | } |
1268 | 1279 | ||
1269 | /// <summary> | 1280 | /// <summary> |
@@ -1859,9 +1870,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1859 | SendFullUpdateToAllClients(); | 1870 | SendFullUpdateToAllClients(); |
1860 | m_requestedSitTargetID = 0; | 1871 | m_requestedSitTargetID = 0; |
1861 | 1872 | ||
1862 | if ((m_physicsActor != null) && (m_avHeight > 0)) | 1873 | if (m_physicsActor != null && m_appearance != null) |
1863 | { | 1874 | { |
1864 | SetHeight(m_avHeight); | 1875 | if (m_appearance.AvatarHeight > 0) |
1876 | SetHeight(m_appearance.AvatarHeight); | ||
1865 | } | 1877 | } |
1866 | } | 1878 | } |
1867 | Animator.TrySetMovementAnimation("STAND"); | 1879 | Animator.TrySetMovementAnimation("STAND"); |
@@ -2728,22 +2740,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
2728 | if (remoteAvatar == null) | 2740 | if (remoteAvatar == null) |
2729 | return; | 2741 | return; |
2730 | 2742 | ||
2731 | IClientAPI cl=remoteAvatar.ControllingClient; | 2743 | IClientAPI cl = remoteAvatar.ControllingClient; |
2732 | if (cl == null) | 2744 | if (cl == null) |
2733 | return; | 2745 | return; |
2734 | 2746 | ||
2735 | if (m_appearance.Texture == null) | 2747 | if (m_appearance.Texture == null) |
2736 | return; | 2748 | return; |
2737 | 2749 | ||
2738 | if (LocalId == remoteAvatar.LocalId) | 2750 | // MT: This is needed for sit. It's legal to send it to oneself, and the name |
2739 | { | 2751 | // of the method is a misnomer |
2740 | m_log.WarnFormat("[SP] An agent is attempting to send data to itself; {0}",UUID); | 2752 | // |
2741 | return; | 2753 | // if (LocalId == remoteAvatar.LocalId) |
2742 | } | 2754 | // { |
2755 | // m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID); | ||
2756 | // return; | ||
2757 | // } | ||
2743 | 2758 | ||
2744 | if (IsChildAgent) | 2759 | if (IsChildAgent) |
2745 | { | 2760 | { |
2746 | m_log.WarnFormat("[SCENEPRESENCE] A child agent is attempting to send out avatar data"); | 2761 | m_log.WarnFormat("[SCENEPRESENCE]: A child agent is attempting to send out avatar data; {0}", UUID); |
2747 | return; | 2762 | return; |
2748 | } | 2763 | } |
2749 | 2764 | ||
@@ -2826,14 +2841,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2826 | { | 2841 | { |
2827 | if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) | 2842 | if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) |
2828 | { | 2843 | { |
2829 | m_log.WarnFormat("[SP] baked textures are in the ache for {0}",Name); | 2844 | // m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); |
2830 | m_controllingClient.SendAppearance( | 2845 | m_controllingClient.SendAppearance( |
2831 | m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes()); | 2846 | m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes()); |
2832 | } | 2847 | } |
2833 | } | 2848 | } |
2834 | else | 2849 | else |
2835 | { | 2850 | { |
2836 | m_log.WarnFormat("[SP] AvatarFactory not set"); | 2851 | m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); |
2837 | } | 2852 | } |
2838 | 2853 | ||
2839 | SendInitialFullUpdateToAllClients(); | 2854 | SendInitialFullUpdateToAllClients(); |
@@ -2845,7 +2860,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2845 | public void SendAppearanceToAllOtherAgents() | 2860 | public void SendAppearanceToAllOtherAgents() |
2846 | { | 2861 | { |
2847 | // DEBUG ON | 2862 | // DEBUG ON |
2848 | m_log.WarnFormat("[SP] Send appearance from {0} to all other agents",m_uuid); | 2863 | // m_log.WarnFormat("[SCENEPRESENCE]: Send appearance from {0} to all other agents", m_uuid); |
2849 | // DEBUG OFF | 2864 | // DEBUG OFF |
2850 | m_perfMonMS = Util.EnvironmentTickCount(); | 2865 | m_perfMonMS = Util.EnvironmentTickCount(); |
2851 | 2866 | ||
@@ -2868,7 +2883,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2868 | { | 2883 | { |
2869 | if (LocalId == avatar.LocalId) | 2884 | if (LocalId == avatar.LocalId) |
2870 | { | 2885 | { |
2871 | m_log.WarnFormat("[SP] An agent is attempting to send data to itself; {0}",UUID); | 2886 | m_log.WarnFormat("[SCENE PRESENCE]: An agent is attempting to send appearance data to itself; {0}", UUID); |
2872 | return; | 2887 | return; |
2873 | } | 2888 | } |
2874 | 2889 | ||
@@ -2920,7 +2935,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2920 | cadu.ActiveGroupID = UUID.Zero.Guid; | 2935 | cadu.ActiveGroupID = UUID.Zero.Guid; |
2921 | cadu.AgentID = UUID.Guid; | 2936 | cadu.AgentID = UUID.Guid; |
2922 | cadu.alwaysrun = m_setAlwaysRun; | 2937 | cadu.alwaysrun = m_setAlwaysRun; |
2923 | cadu.AVHeight = m_avHeight; | 2938 | cadu.AVHeight = m_appearance.AvatarHeight;; |
2924 | Vector3 tempCameraCenter = m_CameraCenter; | 2939 | Vector3 tempCameraCenter = m_CameraCenter; |
2925 | cadu.cameraPosition = tempCameraCenter; | 2940 | cadu.cameraPosition = tempCameraCenter; |
2926 | cadu.drawdistance = m_DrawDistance; | 2941 | cadu.drawdistance = m_DrawDistance; |
@@ -3256,7 +3271,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3256 | 3271 | ||
3257 | m_CameraCenter = cAgentData.Center + offset; | 3272 | m_CameraCenter = cAgentData.Center + offset; |
3258 | 3273 | ||
3259 | m_avHeight = cAgentData.Size.Z; | ||
3260 | //SetHeight(cAgentData.AVHeight); | 3274 | //SetHeight(cAgentData.AVHeight); |
3261 | 3275 | ||
3262 | if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) | 3276 | if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) |
@@ -3281,8 +3295,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3281 | cAgent.Position = AbsolutePosition; | 3295 | cAgent.Position = AbsolutePosition; |
3282 | cAgent.Velocity = m_velocity; | 3296 | cAgent.Velocity = m_velocity; |
3283 | cAgent.Center = m_CameraCenter; | 3297 | cAgent.Center = m_CameraCenter; |
3284 | // Don't copy the size; it is inferred from apearance parameters | ||
3285 | //cAgent.Size = new Vector3(0, 0, m_avHeight); | ||
3286 | cAgent.AtAxis = m_CameraAtAxis; | 3298 | cAgent.AtAxis = m_CameraAtAxis; |
3287 | cAgent.LeftAxis = m_CameraLeftAxis; | 3299 | cAgent.LeftAxis = m_CameraLeftAxis; |
3288 | cAgent.UpAxis = m_CameraUpAxis; | 3300 | cAgent.UpAxis = m_CameraUpAxis; |
@@ -3401,7 +3413,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3401 | 3413 | ||
3402 | m_velocity = cAgent.Velocity; | 3414 | m_velocity = cAgent.Velocity; |
3403 | m_CameraCenter = cAgent.Center; | 3415 | m_CameraCenter = cAgent.Center; |
3404 | //m_avHeight = cAgent.Size.Z; | ||
3405 | m_CameraAtAxis = cAgent.AtAxis; | 3416 | m_CameraAtAxis = cAgent.AtAxis; |
3406 | m_CameraLeftAxis = cAgent.LeftAxis; | 3417 | m_CameraLeftAxis = cAgent.LeftAxis; |
3407 | m_CameraUpAxis = cAgent.UpAxis; | 3418 | m_CameraUpAxis = cAgent.UpAxis; |
@@ -3562,17 +3573,8 @@ if (m_animator.m_jumping) force.Z = m_animator.m_jumpVelocity; // add for ju | |||
3562 | 3573 | ||
3563 | Vector3 pVec = AbsolutePosition; | 3574 | Vector3 pVec = AbsolutePosition; |
3564 | 3575 | ||
3565 | // Old bug where the height was in centimeters instead of meters | 3576 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, |
3566 | if (m_avHeight == 127.0f) | 3577 | new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying); |
3567 | { | ||
3568 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, 1.56f), | ||
3569 | isFlying); | ||
3570 | } | ||
3571 | else | ||
3572 | { | ||
3573 | m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, | ||
3574 | new Vector3(0f, 0f, m_avHeight), isFlying); | ||
3575 | } | ||
3576 | scene.AddPhysicsActorTaint(m_physicsActor); | 3578 | scene.AddPhysicsActorTaint(m_physicsActor); |
3577 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; | 3579 | //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; |
3578 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; | 3580 | m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; |