Merge branch 'master' into httptests
commit
b3eec90d3c
|
@ -5589,6 +5589,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
velocity = presence.Velocity;
|
velocity = presence.Velocity;
|
||||||
acceleration = Vector3.Zero;
|
acceleration = Vector3.Zero;
|
||||||
rotation = presence.Rotation;
|
rotation = presence.Rotation;
|
||||||
|
// tpvs can only see rotations around Z in some cases
|
||||||
|
if(!presence.Flying && !presence.IsSatOnObject)
|
||||||
|
{
|
||||||
|
rotation.X = 0f;
|
||||||
|
rotation.Y = 0f;
|
||||||
|
rotation.Normalize();
|
||||||
|
}
|
||||||
angularVelocity = presence.AngularVelocity;
|
angularVelocity = presence.AngularVelocity;
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
|
@ -5718,6 +5725,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
Vector3 velocity = new Vector3(0, 0, 0);
|
Vector3 velocity = new Vector3(0, 0, 0);
|
||||||
Vector3 acceleration = new Vector3(0, 0, 0);
|
Vector3 acceleration = new Vector3(0, 0, 0);
|
||||||
|
// tpvs can only see rotations around Z in some cases
|
||||||
|
if(!data.Flying && !data.IsSatOnObject)
|
||||||
|
{
|
||||||
|
rotation.X = 0f;
|
||||||
|
rotation.Y = 0f;
|
||||||
|
}
|
||||||
rotation.Normalize();
|
rotation.Normalize();
|
||||||
|
|
||||||
data.CollisionPlane.ToBytes(objectData, 0);
|
data.CollisionPlane.ToBytes(objectData, 0);
|
||||||
|
|
|
@ -290,8 +290,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f);
|
private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f);
|
||||||
private bool SentInitialData = false;
|
private bool SentInitialData = false;
|
||||||
|
|
||||||
private bool m_followCamAuto = false;
|
|
||||||
|
|
||||||
private int m_userFlags;
|
private int m_userFlags;
|
||||||
public int UserFlags
|
public int UserFlags
|
||||||
{
|
{
|
||||||
|
@ -344,6 +342,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private Vector3 m_lastChildAgentUpdatePosition;
|
private Vector3 m_lastChildAgentUpdatePosition;
|
||||||
// private Vector3 m_lastChildAgentUpdateCamPosition;
|
// private Vector3 m_lastChildAgentUpdateCamPosition;
|
||||||
|
|
||||||
|
private Vector3 m_lastCameraRayCastCam;
|
||||||
|
private Vector3 m_lastCameraRayCastPos;
|
||||||
|
|
||||||
|
private float m_FOV = 1.04f;
|
||||||
|
|
||||||
private const int LAND_VELOCITYMAG_MAX = 12;
|
private const int LAND_VELOCITYMAG_MAX = 12;
|
||||||
|
|
||||||
private const float FLY_ROLL_MAX_RADIANS = 1.1f;
|
private const float FLY_ROLL_MAX_RADIANS = 1.1f;
|
||||||
|
@ -374,9 +377,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool LandAtTarget { get; private set; }
|
public bool LandAtTarget { get; private set; }
|
||||||
|
|
||||||
private int m_movementUpdateCount;
|
|
||||||
private const int NumMovementsBetweenRayCast = 5;
|
|
||||||
|
|
||||||
private bool CameraConstraintActive;
|
private bool CameraConstraintActive;
|
||||||
|
|
||||||
private object m_collisionEventLock = new Object();
|
private object m_collisionEventLock = new Object();
|
||||||
|
@ -1159,6 +1159,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
|
ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
|
||||||
ControllingClient.OnAutoPilotGo += MoveToTarget;
|
ControllingClient.OnAutoPilotGo += MoveToTarget;
|
||||||
ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles;
|
ControllingClient.OnUpdateThrottles += RaiseUpdateThrottles;
|
||||||
|
// ControllingClient.OnAgentFOV += HandleAgentFOV;
|
||||||
|
|
||||||
// ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
|
// ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
|
||||||
// ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
|
// ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
|
||||||
|
@ -1178,6 +1179,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls;
|
ControllingClient.OnForceReleaseControls -= HandleForceReleaseControls;
|
||||||
ControllingClient.OnAutoPilotGo -= MoveToTarget;
|
ControllingClient.OnAutoPilotGo -= MoveToTarget;
|
||||||
ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles;
|
ControllingClient.OnUpdateThrottles -= RaiseUpdateThrottles;
|
||||||
|
// ControllingClient.OnAgentFOV += HandleAgentFOV;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetDirectionVectors()
|
private void SetDirectionVectors()
|
||||||
|
@ -2352,34 +2354,41 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
private void checkCameraCollision()
|
private void checkCameraCollision()
|
||||||
{
|
{
|
||||||
if(!m_scene.PhysicsScene.SupportsRayCast())
|
if(m_doingCamRayCast || !m_scene.PhysicsScene.SupportsRayCast())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
++m_movementUpdateCount;
|
if(m_mouseLook || ParentID != 0)
|
||||||
if (m_movementUpdateCount < 1)
|
|
||||||
m_movementUpdateCount = 1;
|
|
||||||
|
|
||||||
if (m_doingCamRayCast || m_movementUpdateCount % NumMovementsBetweenRayCast != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_followCamAuto && !m_mouseLook)
|
|
||||||
{
|
{
|
||||||
Vector3 posAdjusted = AbsolutePosition;
|
if (CameraConstraintActive)
|
||||||
// posAdjusted.Z += 0.5f * Appearance.AvatarSize.Z - 0.5f;
|
|
||||||
// not good for tiny or huge avatars
|
|
||||||
posAdjusted.Z += 1.0f; // viewer current camera focus point
|
|
||||||
Vector3 tocam = CameraPosition - posAdjusted;
|
|
||||||
|
|
||||||
float distTocamlen = tocam.LengthSquared();
|
|
||||||
if (distTocamlen > 0.01f && distTocamlen < 400)
|
|
||||||
{
|
{
|
||||||
distTocamlen = (float)Math.Sqrt(distTocamlen);
|
Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -10000f); // not right...
|
||||||
tocam *= (1.0f / distTocamlen);
|
UpdateCameraCollisionPlane(plane);
|
||||||
|
CameraConstraintActive = false;
|
||||||
m_doingCamRayCast = true;
|
|
||||||
m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector3 posAdjusted = AbsolutePosition;
|
||||||
|
posAdjusted.Z += 1.0f; // viewer current camera focus point
|
||||||
|
|
||||||
|
if(posAdjusted.ApproxEquals(m_lastCameraRayCastPos, 0.2f) &&
|
||||||
|
CameraPosition.ApproxEquals(m_lastCameraRayCastCam, 0.2f))
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_lastCameraRayCastCam = CameraPosition;
|
||||||
|
m_lastCameraRayCastPos = posAdjusted;
|
||||||
|
|
||||||
|
Vector3 tocam = CameraPosition - posAdjusted;
|
||||||
|
|
||||||
|
float distTocamlen = tocam.LengthSquared();
|
||||||
|
if (distTocamlen > 0.01f && distTocamlen < 400)
|
||||||
|
{
|
||||||
|
distTocamlen = (float)Math.Sqrt(distTocamlen);
|
||||||
|
tocam *= (1.0f / distTocamlen);
|
||||||
|
|
||||||
|
m_doingCamRayCast = true;
|
||||||
|
m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CameraConstraintActive)
|
if (CameraConstraintActive)
|
||||||
|
@ -2401,9 +2410,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal)
|
public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal)
|
||||||
{
|
{
|
||||||
// const float POSITION_TOLERANCE = 0.02f;
|
|
||||||
// const float ROTATION_TOLERANCE = 0.02f;
|
|
||||||
|
|
||||||
if (hitYN && localid != LocalId)
|
if (hitYN && localid != LocalId)
|
||||||
{
|
{
|
||||||
if (localid != 0)
|
if (localid != 0)
|
||||||
|
@ -2441,8 +2447,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
UpdateCameraCollisionPlane(plane);
|
UpdateCameraCollisionPlane(plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
|
|
||||||
// !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE))
|
|
||||||
else if(CameraConstraintActive)
|
else if(CameraConstraintActive)
|
||||||
{
|
{
|
||||||
Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -9000f); // not right...
|
Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -9000f); // not right...
|
||||||
|
@ -2538,7 +2542,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// Raycast from the avatar's head to the camera to see if there's anything blocking the view
|
// Raycast from the avatar's head to the camera to see if there's anything blocking the view
|
||||||
// this exclude checks may not be complete
|
// this exclude checks may not be complete
|
||||||
if(agentData.NeedsCameraCollision && ParentID == 0) // condition parentID may be wrong
|
if(agentData.NeedsCameraCollision) // condition parentID may be wrong
|
||||||
checkCameraCollision();
|
checkCameraCollision();
|
||||||
|
|
||||||
uint flagsForScripts = (uint)flags;
|
uint flagsForScripts = (uint)flags;
|
||||||
|
@ -2807,6 +2811,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// m_scene.EventManager.TriggerOnClientMovement(this);
|
// m_scene.EventManager.TriggerOnClientMovement(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HandleAgentFOV(IClientAPI remoteClient, float _fov)
|
||||||
|
{
|
||||||
|
m_FOV = _fov;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is the event handler for client cameras. If a client is moving, or moving the camera, this event is triggering.
|
/// 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
|
||||||
Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis);
|
Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis);
|
||||||
CameraRotation = camRot;
|
CameraRotation = camRot;
|
||||||
|
|
||||||
// Check if Client has camera in 'follow cam' or 'build' mode.
|
|
||||||
// Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
|
|
||||||
m_followCamAuto = false;
|
|
||||||
if(!m_mouseLook)
|
|
||||||
{
|
|
||||||
if((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.99f))
|
|
||||||
{
|
|
||||||
Vector3 camdif = new Vector3(1f, 0f, 0f) * Rotation;
|
|
||||||
float ftmp = camdif.X - CameraAtAxis.X;
|
|
||||||
if(Math.Abs(ftmp) < 0.1f)
|
|
||||||
{
|
|
||||||
ftmp = camdif.Y - CameraAtAxis.Y;
|
|
||||||
if(Math.Abs(ftmp) < 0.1f)
|
|
||||||
m_followCamAuto = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(agentData.NeedsCameraCollision)
|
if(agentData.NeedsCameraCollision)
|
||||||
checkCameraCollision();
|
checkCameraCollision();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue