diff options
author | UbitUmarov | 2017-08-25 23:47:40 +0100 |
---|---|---|
committer | UbitUmarov | 2017-08-25 23:47:40 +0100 |
commit | b3eec90d3cbf945e2102becd8e1e1c26f7936ece (patch) | |
tree | 9ccede89df93bf2d65b77e648a6a00f1d6375906 | |
parent | Merge branch 'master' into httptests (diff) | |
parent | in some cases ll TPVs can only see avatar rotations around Z or camera misbe... (diff) | |
download | opensim-SC-b3eec90d3cbf945e2102becd8e1e1c26f7936ece.zip opensim-SC-b3eec90d3cbf945e2102becd8e1e1c26f7936ece.tar.gz opensim-SC-b3eec90d3cbf945e2102becd8e1e1c26f7936ece.tar.bz2 opensim-SC-b3eec90d3cbf945e2102becd8e1e1c26f7936ece.tar.xz |
Merge branch 'master' into httptests
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 90 |
2 files changed, 53 insertions, 50 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 6dd3885..c44c741 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -5589,6 +5589,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5589 | velocity = presence.Velocity; | 5589 | velocity = presence.Velocity; |
5590 | acceleration = Vector3.Zero; | 5590 | acceleration = Vector3.Zero; |
5591 | rotation = presence.Rotation; | 5591 | rotation = presence.Rotation; |
5592 | // tpvs can only see rotations around Z in some cases | ||
5593 | if(!presence.Flying && !presence.IsSatOnObject) | ||
5594 | { | ||
5595 | rotation.X = 0f; | ||
5596 | rotation.Y = 0f; | ||
5597 | rotation.Normalize(); | ||
5598 | } | ||
5592 | angularVelocity = presence.AngularVelocity; | 5599 | angularVelocity = presence.AngularVelocity; |
5593 | 5600 | ||
5594 | // m_log.DebugFormat( | 5601 | // m_log.DebugFormat( |
@@ -5718,6 +5725,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5718 | 5725 | ||
5719 | Vector3 velocity = new Vector3(0, 0, 0); | 5726 | Vector3 velocity = new Vector3(0, 0, 0); |
5720 | Vector3 acceleration = new Vector3(0, 0, 0); | 5727 | Vector3 acceleration = new Vector3(0, 0, 0); |
5728 | // tpvs can only see rotations around Z in some cases | ||
5729 | if(!data.Flying && !data.IsSatOnObject) | ||
5730 | { | ||
5731 | rotation.X = 0f; | ||
5732 | rotation.Y = 0f; | ||
5733 | } | ||
5721 | rotation.Normalize(); | 5734 | rotation.Normalize(); |
5722 | 5735 | ||
5723 | data.CollisionPlane.ToBytes(objectData, 0); | 5736 | data.CollisionPlane.ToBytes(objectData, 0); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index f9c7031..9cceb06 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -290,8 +290,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
290 | private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); | 290 | private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); |
291 | private bool SentInitialData = false; | 291 | private bool SentInitialData = false; |
292 | 292 | ||
293 | private bool m_followCamAuto = false; | ||
294 | |||
295 | private int m_userFlags; | 293 | private int m_userFlags; |
296 | public int UserFlags | 294 | public int UserFlags |
297 | { | 295 | { |
@@ -344,6 +342,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
344 | private Vector3 m_lastChildAgentUpdatePosition; | 342 | private Vector3 m_lastChildAgentUpdatePosition; |
345 | // private Vector3 m_lastChildAgentUpdateCamPosition; | 343 | // private Vector3 m_lastChildAgentUpdateCamPosition; |
346 | 344 | ||
345 | private Vector3 m_lastCameraRayCastCam; | ||
346 | private Vector3 m_lastCameraRayCastPos; | ||
347 | |||
348 | private float m_FOV = 1.04f; | ||
349 | |||
347 | private const int LAND_VELOCITYMAG_MAX = 12; | 350 | private const int LAND_VELOCITYMAG_MAX = 12; |
348 | 351 | ||
349 | private const float FLY_ROLL_MAX_RADIANS = 1.1f; | 352 | private const float FLY_ROLL_MAX_RADIANS = 1.1f; |
@@ -374,9 +377,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
374 | /// </summary> | 377 | /// </summary> |
375 | public bool LandAtTarget { get; private set; } | 378 | public bool LandAtTarget { get; private set; } |
376 | 379 | ||
377 | private int m_movementUpdateCount; | ||
378 | private const int NumMovementsBetweenRayCast = 5; | ||
379 | |||
380 | private bool CameraConstraintActive; | 380 | private bool CameraConstraintActive; |
381 | 381 | ||
382 | private object m_collisionEventLock = new Object(); | 382 | private object m_collisionEventLock = new Object(); |
@@ -1159,6 +1159,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1159 | ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; | 1159 | ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; |
1160 | ControllingClient.OnAutoPilotGo += MoveToTarget; | 1160 | ControllingClient.OnAutoPilotGo += MoveToTarget; |
1161 | ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; | 1161 | ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles; |
1162 | // ControllingClient.OnAgentFOV += HandleAgentFOV; | ||
1162 | 1163 | ||
1163 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 1164 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
1164 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 1165 | // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
@@ -1178,6 +1179,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1178 | ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; | 1179 | ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls; |
1179 | ControllingClient.OnAutoPilotGo -= MoveToTarget; | 1180 | ControllingClient.OnAutoPilotGo -= MoveToTarget; |
1180 | ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; | 1181 | ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles; |
1182 | // ControllingClient.OnAgentFOV += HandleAgentFOV; | ||
1181 | } | 1183 | } |
1182 | 1184 | ||
1183 | private void SetDirectionVectors() | 1185 | private void SetDirectionVectors() |
@@ -2352,34 +2354,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
2352 | 2354 | ||
2353 | private void checkCameraCollision() | 2355 | private void checkCameraCollision() |
2354 | { | 2356 | { |
2355 | if(!m_scene.PhysicsScene.SupportsRayCast()) | 2357 | if(m_doingCamRayCast || !m_scene.PhysicsScene.SupportsRayCast()) |
2356 | return; | 2358 | return; |
2357 | 2359 | ||
2358 | ++m_movementUpdateCount; | 2360 | if(m_mouseLook || ParentID != 0) |
2359 | if (m_movementUpdateCount < 1) | 2361 | { |
2360 | m_movementUpdateCount = 1; | 2362 | if (CameraConstraintActive) |
2363 | { | ||
2364 | Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -10000f); // not right... | ||
2365 | UpdateCameraCollisionPlane(plane); | ||
2366 | CameraConstraintActive = false; | ||
2367 | } | ||
2368 | return; | ||
2369 | } | ||
2370 | |||
2371 | Vector3 posAdjusted = AbsolutePosition; | ||
2372 | posAdjusted.Z += 1.0f; // viewer current camera focus point | ||
2361 | 2373 | ||
2362 | if (m_doingCamRayCast || m_movementUpdateCount % NumMovementsBetweenRayCast != 0) | 2374 | if(posAdjusted.ApproxEquals(m_lastCameraRayCastPos, 0.2f) && |
2375 | CameraPosition.ApproxEquals(m_lastCameraRayCastCam, 0.2f)) | ||
2363 | return; | 2376 | return; |
2364 | 2377 | ||
2365 | if (m_followCamAuto && !m_mouseLook) | 2378 | m_lastCameraRayCastCam = CameraPosition; |
2366 | { | 2379 | m_lastCameraRayCastPos = posAdjusted; |
2367 | Vector3 posAdjusted = AbsolutePosition; | ||
2368 | // posAdjusted.Z += 0.5f * Appearance.AvatarSize.Z - 0.5f; | ||
2369 | // not good for tiny or huge avatars | ||
2370 | posAdjusted.Z += 1.0f; // viewer current camera focus point | ||
2371 | Vector3 tocam = CameraPosition - posAdjusted; | ||
2372 | 2380 | ||
2373 | float distTocamlen = tocam.LengthSquared(); | 2381 | Vector3 tocam = CameraPosition - posAdjusted; |
2374 | if (distTocamlen > 0.01f && distTocamlen < 400) | ||
2375 | { | ||
2376 | distTocamlen = (float)Math.Sqrt(distTocamlen); | ||
2377 | tocam *= (1.0f / distTocamlen); | ||
2378 | 2382 | ||
2379 | m_doingCamRayCast = true; | 2383 | float distTocamlen = tocam.LengthSquared(); |
2380 | m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback); | 2384 | if (distTocamlen > 0.01f && distTocamlen < 400) |
2381 | return; | 2385 | { |
2382 | } | 2386 | distTocamlen = (float)Math.Sqrt(distTocamlen); |
2387 | tocam *= (1.0f / distTocamlen); | ||
2388 | |||
2389 | m_doingCamRayCast = true; | ||
2390 | m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback); | ||
2391 | return; | ||
2383 | } | 2392 | } |
2384 | 2393 | ||
2385 | if (CameraConstraintActive) | 2394 | if (CameraConstraintActive) |
@@ -2401,9 +2410,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2401 | 2410 | ||
2402 | public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal) | 2411 | public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal) |
2403 | { | 2412 | { |
2404 | // const float POSITION_TOLERANCE = 0.02f; | ||
2405 | // const float ROTATION_TOLERANCE = 0.02f; | ||
2406 | |||
2407 | if (hitYN && localid != LocalId) | 2413 | if (hitYN && localid != LocalId) |
2408 | { | 2414 | { |
2409 | if (localid != 0) | 2415 | if (localid != 0) |
@@ -2441,8 +2447,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2441 | UpdateCameraCollisionPlane(plane); | 2447 | UpdateCameraCollisionPlane(plane); |
2442 | } | 2448 | } |
2443 | } | 2449 | } |
2444 | // else if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || | ||
2445 | // !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) | ||
2446 | else if(CameraConstraintActive) | 2450 | else if(CameraConstraintActive) |
2447 | { | 2451 | { |
2448 | Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -9000f); // not right... | 2452 | Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -9000f); // not right... |
@@ -2538,7 +2542,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2538 | 2542 | ||
2539 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view | 2543 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view |
2540 | // this exclude checks may not be complete | 2544 | // this exclude checks may not be complete |
2541 | if(agentData.NeedsCameraCollision && ParentID == 0) // condition parentID may be wrong | 2545 | if(agentData.NeedsCameraCollision) // condition parentID may be wrong |
2542 | checkCameraCollision(); | 2546 | checkCameraCollision(); |
2543 | 2547 | ||
2544 | uint flagsForScripts = (uint)flags; | 2548 | uint flagsForScripts = (uint)flags; |
@@ -2807,6 +2811,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2807 | // m_scene.EventManager.TriggerOnClientMovement(this); | 2811 | // m_scene.EventManager.TriggerOnClientMovement(this); |
2808 | } | 2812 | } |
2809 | 2813 | ||
2814 | private void HandleAgentFOV(IClientAPI remoteClient, float _fov) | ||
2815 | { | ||
2816 | m_FOV = _fov; | ||
2817 | } | ||
2810 | 2818 | ||
2811 | /// <summary> | 2819 | /// <summary> |
2812 | /// This is the event handler for client cameras. If a client is moving, or moving the camera, this event is triggering. | 2820 | /// This is the event handler for client cameras. If a client is moving, or moving the camera, this event is triggering. |
@@ -2843,24 +2851,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2843 | Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); | 2851 | Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); |
2844 | CameraRotation = camRot; | 2852 | CameraRotation = camRot; |
2845 | 2853 | ||
2846 | // Check if Client has camera in 'follow cam' or 'build' mode. | ||
2847 | // Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); | ||
2848 | m_followCamAuto = false; | ||
2849 | if(!m_mouseLook) | ||
2850 | { | ||
2851 | if((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.99f)) | ||
2852 | { | ||
2853 | Vector3 camdif = new Vector3(1f, 0f, 0f) * Rotation; | ||
2854 | float ftmp = camdif.X - CameraAtAxis.X; | ||
2855 | if(Math.Abs(ftmp) < 0.1f) | ||
2856 | { | ||
2857 | ftmp = camdif.Y - CameraAtAxis.Y; | ||
2858 | if(Math.Abs(ftmp) < 0.1f) | ||
2859 | m_followCamAuto = true; | ||
2860 | } | ||
2861 | } | ||
2862 | } | ||
2863 | |||
2864 | if(agentData.NeedsCameraCollision) | 2854 | if(agentData.NeedsCameraCollision) |
2865 | checkCameraCollision(); | 2855 | checkCameraCollision(); |
2866 | 2856 | ||