From b574d43c5d5706cf6325c909ddf0ff573e44e49b Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 13 Apr 2012 20:34:56 +0100 Subject: Use presence absolute position to request raycast to camera. Used m_pos maybe a sitting offset. For reasons i don't understand that also seems to crash ode more when i let this rays colide with heighmaps (ubitODE with normal ode lib). --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c4b75bd..855a341 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -753,7 +753,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_movementAnimationUpdateCounter >= 2) { m_movementAnimationUpdateCounter = 0; - if (Animator != null && ParentID == 0) // don't do it sitting + if (Animator != null && ParentID == 0) // skip it if sitting { Animator.UpdateMovementAnimations(); } @@ -1386,8 +1386,16 @@ namespace OpenSim.Region.Framework.Scenes { if (m_followCamAuto) { - Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; - m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); + // Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; + // m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); + Vector3 posAdjusted = AbsolutePosition + HEAD_ADJUSTMENT; + Vector3 distTocam = CameraPosition - posAdjusted; + float distTocamlen = distTocam.Length(); + if (distTocamlen > 0) + { + distTocam *= 1.0f / distTocamlen; + m_scene.PhysicsScene.RaycastWorld(posAdjusted, distTocam, distTocamlen + 0.3f, RayCastCameraCallback); + } } } -- cgit v1.1