diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b6172d2..729d5a9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1110,6 +1110,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1110 | 1110 | ||
1111 | #region Status Methods | 1111 | #region Status Methods |
1112 | 1112 | ||
1113 | void PhysicsCheckPositionZ() | ||
1114 | { | ||
1115 | if(m_scene.PhysicsScene == null) | ||
1116 | return; | ||
1117 | } | ||
1118 | |||
1113 | /// <summary> | 1119 | /// <summary> |
1114 | /// Turns a child agent into a root agent. | 1120 | /// Turns a child agent into a root agent. |
1115 | /// </summary> | 1121 | /// </summary> |
@@ -1195,7 +1201,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1195 | 1201 | ||
1196 | if (ParentID == 0) | 1202 | if (ParentID == 0) |
1197 | { | 1203 | { |
1198 | if(!CheckAndAdjustLandingPoint(ref pos, ref lookat)) | 1204 | bool positionChanged = false; |
1205 | if(!CheckAndAdjustLandingPoint(ref pos, ref lookat, ref positionChanged )) | ||
1199 | { | 1206 | { |
1200 | m_log.DebugFormat("[SCENE PRESENCE MakeRootAgent]: houston we have a problem.. {0}({1} got here banned",Name, UUID); | 1207 | m_log.DebugFormat("[SCENE PRESENCE MakeRootAgent]: houston we have a problem.. {0}({1} got here banned",Name, UUID); |
1201 | } | 1208 | } |
@@ -1218,6 +1225,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1218 | pos.Y = m_scene.RegionInfo.RegionSizeY - 0.5f; | 1225 | pos.Y = m_scene.RegionInfo.RegionSizeY - 0.5f; |
1219 | } | 1226 | } |
1220 | 1227 | ||
1228 | bool checkPhysics = !positionChanged && | ||
1229 | m_scene.SupportsRayCastFiltered() && | ||
1230 | ((m_teleportFlags & (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID)) == | ||
1231 | (TeleportFlags.ViaLogin | TeleportFlags.ViaRegionID) | ||
1232 | || (m_teleportFlags & TeleportFlags.ViaLocation) != 0 | ||
1233 | || (m_teleportFlags & TeleportFlags.ViaHGLogin) != 0); | ||
1234 | |||
1221 | float localAVHeight = 1.56f; | 1235 | float localAVHeight = 1.56f; |
1222 | if (Appearance.AvatarHeight > 0) | 1236 | if (Appearance.AvatarHeight > 0) |
1223 | localAVHeight = Appearance.AvatarHeight; | 1237 | localAVHeight = Appearance.AvatarHeight; |
@@ -1227,6 +1241,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1227 | if (newPosZ > pos.Z) | 1241 | if (newPosZ > pos.Z) |
1228 | pos.Z = newPosZ; | 1242 | pos.Z = newPosZ; |
1229 | 1243 | ||
1244 | if(checkPhysics) | ||
1245 | { | ||
1246 | // no land!! | ||
1247 | RayFilterFlags rayfilter = RayFilterFlags.ClosestAndBackCull; | ||
1248 | rayfilter |= RayFilterFlags.physical; | ||
1249 | rayfilter |= RayFilterFlags.nonphysical; | ||
1250 | rayfilter |= RayFilterFlags.LSLPhantom; // ubODE will only see volume detectors | ||
1251 | int physcount = 1; | ||
1252 | float dist = 1024f; | ||
1253 | Vector3 direction = new Vector3(0f,0f,-1f); | ||
1254 | Vector3 RayStart = pos; | ||
1255 | RayStart.Z += dist; | ||
1256 | |||
1257 | List<ContactResult> physresults = | ||
1258 | (List<ContactResult>)m_scene.RayCastFiltered(RayStart, direction, dist, physcount, rayfilter); | ||
1259 | if (physresults != null && physresults.Count > 0) | ||
1260 | { | ||
1261 | float d = physresults[0].Pos.Z + 0.5f * localAVHeight; | ||
1262 | if(d > pos.Z) | ||
1263 | pos.Z = d; | ||
1264 | } | ||
1265 | } | ||
1266 | |||
1230 | AbsolutePosition = pos; | 1267 | AbsolutePosition = pos; |
1231 | 1268 | ||
1232 | // m_log.DebugFormat( | 1269 | // m_log.DebugFormat( |
@@ -5531,7 +5568,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5531 | const TeleportFlags TeleHubTPFlags = TeleportFlags.ViaLogin | 5568 | const TeleportFlags TeleHubTPFlags = TeleportFlags.ViaLogin |
5532 | | TeleportFlags.ViaHGLogin | TeleportFlags.ViaLocation; | 5569 | | TeleportFlags.ViaHGLogin | TeleportFlags.ViaLocation; |
5533 | 5570 | ||
5534 | private bool CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos) | 5571 | private bool CheckAndAdjustTelehub(SceneObjectGroup telehub, ref Vector3 pos, ref bool positionChanged) |
5535 | { | 5572 | { |
5536 | // forcing telehubs on any tp that reachs this | 5573 | // forcing telehubs on any tp that reachs this |
5537 | if ((m_teleportFlags & TeleHubTPFlags) != 0 || | 5574 | if ((m_teleportFlags & TeleHubTPFlags) != 0 || |
@@ -5549,6 +5586,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5549 | pos = teleHubPosition; | 5586 | pos = teleHubPosition; |
5550 | if(land.IsEitherBannedOrRestricted(UUID)) | 5587 | if(land.IsEitherBannedOrRestricted(UUID)) |
5551 | return false; | 5588 | return false; |
5589 | positionChanged = true; | ||
5552 | return true; | 5590 | return true; |
5553 | } | 5591 | } |
5554 | else | 5592 | else |
@@ -5613,6 +5651,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5613 | 5651 | ||
5614 | if(!selected) | 5652 | if(!selected) |
5615 | return false; | 5653 | return false; |
5654 | positionChanged = true; | ||
5616 | return true; | 5655 | return true; |
5617 | 5656 | ||
5618 | default: | 5657 | default: |
@@ -5646,10 +5685,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
5646 | if(closest < 0) | 5685 | if(closest < 0) |
5647 | { | 5686 | { |
5648 | pos = spawnPoints[0].GetLocation(teleHubPosition, teleHubRotation); | 5687 | pos = spawnPoints[0].GetLocation(teleHubPosition, teleHubRotation); |
5688 | positionChanged = true; | ||
5649 | return false; | 5689 | return false; |
5650 | } | 5690 | } |
5651 | 5691 | ||
5652 | pos = spawnPoints[closest].GetLocation(teleHubPosition, teleHubRotation); | 5692 | pos = spawnPoints[closest].GetLocation(teleHubPosition, teleHubRotation); |
5693 | positionChanged = true; | ||
5653 | return true; | 5694 | return true; |
5654 | } | 5695 | } |
5655 | } | 5696 | } |
@@ -5660,7 +5701,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5660 | TeleportFlags.ViaLocation | TeleportFlags.ViaHGLogin; | 5701 | TeleportFlags.ViaLocation | TeleportFlags.ViaHGLogin; |
5661 | 5702 | ||
5662 | // Modify landing point based on telehubs or parcel restrictions. | 5703 | // Modify landing point based on telehubs or parcel restrictions. |
5663 | private bool CheckAndAdjustLandingPoint(ref Vector3 pos, ref Vector3 lookat) | 5704 | private bool CheckAndAdjustLandingPoint(ref Vector3 pos, ref Vector3 lookat, ref bool positionChanged) |
5664 | { | 5705 | { |
5665 | string reason; | 5706 | string reason; |
5666 | 5707 | ||
@@ -5677,7 +5718,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5677 | SceneObjectGroup telehub = null; | 5718 | SceneObjectGroup telehub = null; |
5678 | if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) | 5719 | if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero && (telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject)) != null) |
5679 | { | 5720 | { |
5680 | if(CheckAndAdjustTelehub(telehub, ref pos)) | 5721 | if(CheckAndAdjustTelehub(telehub, ref pos, ref positionChanged)) |
5681 | return true; | 5722 | return true; |
5682 | } | 5723 | } |
5683 | } | 5724 | } |
@@ -5706,6 +5747,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5706 | pos = land.LandData.UserLocation; | 5747 | pos = land.LandData.UserLocation; |
5707 | if(land.LandData.UserLookAt != Vector3.Zero) | 5748 | if(land.LandData.UserLookAt != Vector3.Zero) |
5708 | lookat = land.LandData.UserLookAt; | 5749 | lookat = land.LandData.UserLookAt; |
5750 | positionChanged = true; | ||
5709 | } | 5751 | } |
5710 | } | 5752 | } |
5711 | } | 5753 | } |