Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim

mysql-performance
Melanie 2009-12-06 02:54:47 +00:00
commit a44749b9d2
3 changed files with 30 additions and 8 deletions

View File

@ -1105,7 +1105,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="collisionPoint"></param> /// <param name="collisionPoint"></param>
/// <param name="localid"></param> /// <param name="localid"></param>
/// <param name="distance"></param> /// <param name="distance"></param>
public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance) public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal)
{ {
const float POSITION_TOLERANCE = 0.02f; const float POSITION_TOLERANCE = 0.02f;
const float VELOCITY_TOLERANCE = 0.02f; const float VELOCITY_TOLERANCE = 0.02f;
@ -1686,8 +1686,13 @@ namespace OpenSim.Region.Framework.Scenes
bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero));
bool SitTargetisSet = bool SitTargetisSet =
(!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 0f && (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f &&
avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f)); (
avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 1f // Valid Zero Rotation quaternion
|| avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point
|| avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion
)
));
if (SitTargetisSet && SitTargetUnOccupied) if (SitTargetisSet && SitTargetUnOccupied)
{ {
@ -1750,7 +1755,7 @@ namespace OpenSim.Region.Framework.Scenes
StandUp(); StandUp();
} }
m_nextSitAnimation = "SIT"; m_nextSitAnimation = "SIT";
//SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
SceneObjectPart part = FindNextAvailableSitTarget(targetID); SceneObjectPart part = FindNextAvailableSitTarget(targetID);
@ -1762,12 +1767,23 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_requestedSitTargetID = part.LocalId; m_requestedSitTargetID = part.LocalId;
//m_requestedSitOffset = offset; //m_requestedSitOffset = offset;
//offset.X += part.Scale.X;// *offset.X;
//offset.Y += part.Scale.Y;// * offset.Y;
//offset.Z += part.Scale.Z;// * offset.Z;
//m_requestedSitOffset = offset;
m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset);
} }
else else
{ {
m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
} }
if (m_scene.PhysicsScene.SupportsRayCast())
{
//m_scene.PhysicsScene.RaycastWorld(Vector3.Zero,Vector3.Zero, 0.01f,new RaycastCallback());
}
SendSitResponse(remoteClient, targetID, offset); SendSitResponse(remoteClient, targetID, offset);
} }

View File

@ -36,7 +36,7 @@ namespace OpenSim.Region.Physics.Manager
{ {
public delegate void physicsCrash(); public delegate void physicsCrash();
public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance); public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal);
public abstract class PhysicsScene public abstract class PhysicsScene
{ {
@ -204,7 +204,7 @@ namespace OpenSim.Region.Physics.Manager
public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod) public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
{ {
if (retMethod != null) if (retMethod != null)
retMethod(false, Vector3.Zero, 0, 999999999999f); retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero);
} }
private class NullPhysicsScene : PhysicsScene private class NullPhysicsScene : PhysicsScene

View File

@ -145,6 +145,7 @@ namespace OpenSim.Region.Physics.OdePlugin
uint hitConsumerID = 0; uint hitConsumerID = 0;
float distance = 999999999999f; float distance = 999999999999f;
Vector3 closestcontact = new Vector3(99999f, 99999f, 99999f); Vector3 closestcontact = new Vector3(99999f, 99999f, 99999f);
Vector3 snormal = Vector3.Zero;
// Find closest contact and object. // Find closest contact and object.
lock (m_contactResults) lock (m_contactResults)
@ -157,6 +158,7 @@ namespace OpenSim.Region.Physics.OdePlugin
hitConsumerID = cResult.ConsumerID; hitConsumerID = cResult.ConsumerID;
distance = cResult.Depth; distance = cResult.Depth;
hitYN = true; hitYN = true;
snormal = cResult.Normal;
} }
} }
@ -165,7 +167,7 @@ namespace OpenSim.Region.Physics.OdePlugin
// Return results // Return results
if (req.callbackMethod != null) if (req.callbackMethod != null)
req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance); req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance, snormal);
} }
// This is the standard Near. Uses space AABBs to speed up detection. // This is the standard Near. Uses space AABBs to speed up detection.
@ -310,7 +312,8 @@ namespace OpenSim.Region.Physics.OdePlugin
collisionresult.ConsumerID = ((OdePrim)p1).m_localID; collisionresult.ConsumerID = ((OdePrim)p1).m_localID;
collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
collisionresult.Depth = contacts[i].depth; collisionresult.Depth = contacts[i].depth;
collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
contacts[i].normal.Z);
lock (m_contactResults) lock (m_contactResults)
m_contactResults.Add(collisionresult); m_contactResults.Add(collisionresult);
} }
@ -325,6 +328,8 @@ namespace OpenSim.Region.Physics.OdePlugin
collisionresult.ConsumerID = ((OdePrim)p2).m_localID; collisionresult.ConsumerID = ((OdePrim)p2).m_localID;
collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
collisionresult.Depth = contacts[i].depth; collisionresult.Depth = contacts[i].depth;
collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
contacts[i].normal.Z);
lock (m_contactResults) lock (m_contactResults)
m_contactResults.Add(collisionresult); m_contactResults.Add(collisionresult);
@ -358,5 +363,6 @@ namespace OpenSim.Region.Physics.OdePlugin
public Vector3 Pos; public Vector3 Pos;
public float Depth; public float Depth;
public uint ConsumerID; public uint ConsumerID;
public Vector3 Normal;
} }
} }