diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5d0baf3..a19f029 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1538,33 +1538,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
1538 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view | 1538 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view |
1539 | // this exclude checks may not be complete | 1539 | // this exclude checks may not be complete |
1540 | 1540 | ||
1541 | if (!m_doingCamRayCast && !m_mouseLook && m_scene.PhysicsScene.SupportsRayCast() && ParentID == 0) | 1541 | if (m_movementUpdateCount % NumMovementsBetweenRayCast == 0 && m_scene.PhysicsScene.SupportsRayCast()) |
1542 | { | 1542 | { |
1543 | Vector3 posAdjusted = AbsolutePosition; | 1543 | if (!m_doingCamRayCast && !m_mouseLook && ParentID == 0) |
1544 | posAdjusted.Z += 0.5f * Appearance.AvatarSize.Z - 0.5f; | ||
1545 | |||
1546 | Vector3 tocam = CameraPosition - posAdjusted; | ||
1547 | tocam.X = (float)Math.Round(tocam.X, 1); | ||
1548 | tocam.Y = (float)Math.Round(tocam.Y, 1); | ||
1549 | tocam.Z = (float)Math.Round(tocam.Z, 1); | ||
1550 | |||
1551 | float distTocamlen = tocam.Length(); | ||
1552 | if (distTocamlen > 0.3f) | ||
1553 | { | 1544 | { |
1554 | tocam *= (1.0f / distTocamlen); | 1545 | Vector3 posAdjusted = AbsolutePosition; |
1555 | posAdjusted.X = (float)Math.Round(posAdjusted.X, 1); | 1546 | posAdjusted.Z += 0.5f * Appearance.AvatarSize.Z - 0.5f; |
1556 | posAdjusted.Y = (float)Math.Round(posAdjusted.Y, 1); | 1547 | |
1557 | posAdjusted.Z = (float)Math.Round(posAdjusted.Z, 1); | 1548 | Vector3 tocam = CameraPosition - posAdjusted; |
1549 | tocam.X = (float)Math.Round(tocam.X, 1); | ||
1550 | tocam.Y = (float)Math.Round(tocam.Y, 1); | ||
1551 | tocam.Z = (float)Math.Round(tocam.Z, 1); | ||
1558 | 1552 | ||
1559 | m_doingCamRayCast = true; | 1553 | float distTocamlen = tocam.Length(); |
1560 | m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback); | 1554 | if (distTocamlen > 0.3f) |
1555 | { | ||
1556 | tocam *= (1.0f / distTocamlen); | ||
1557 | posAdjusted.X = (float)Math.Round(posAdjusted.X, 1); | ||
1558 | posAdjusted.Y = (float)Math.Round(posAdjusted.Y, 1); | ||
1559 | posAdjusted.Z = (float)Math.Round(posAdjusted.Z, 1); | ||
1560 | |||
1561 | m_doingCamRayCast = true; | ||
1562 | m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback); | ||
1563 | } | ||
1564 | } | ||
1565 | else if (CameraConstraintActive && (m_mouseLook || ParentID != 0)) | ||
1566 | { | ||
1567 | Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -10000f); // not right... | ||
1568 | UpdateCameraCollisionPlane(plane); | ||
1569 | CameraConstraintActive = false; | ||
1561 | } | 1570 | } |
1562 | } | ||
1563 | else if (CameraConstraintActive && (m_mouseLook || ParentID != 0) ) | ||
1564 | { | ||
1565 | Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -10000f); // not right... | ||
1566 | UpdateCameraCollisionPlane(plane); | ||
1567 | CameraConstraintActive = false; | ||
1568 | } | 1571 | } |
1569 | 1572 | ||
1570 | uint flagsForScripts = (uint)flags; | 1573 | uint flagsForScripts = (uint)flags; |