avinationmerge
UbitUmarov 2012-12-18 00:50:36 +00:00
parent 9089bc7e37
commit f87af983f3
3 changed files with 27 additions and 8 deletions

View File

@ -353,7 +353,7 @@ namespace OpenSim.Region.Physics.Manager
public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, RaycastCallback retMethod){}
public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayCallback retMethod) { }
public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count)
public virtual List<ContactResult> RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayFilterFlags flags)
{
return new List<ContactResult>();
}

View File

@ -199,6 +199,20 @@ namespace OpenSim.Region.Physics.OdePlugin
m_PendingRequests.Enqueue(req);
}
public void QueueRequest(IntPtr geom, Vector3 position, Vector3 direction, float length, int count,RayFilterFlags flags, RayCallback retMethod)
{
ODERayRequest req = new ODERayRequest();
req.geom = geom;
req.callbackMethod = retMethod;
req.length = length;
req.Normal = direction;
req.Origin = position;
req.Count = count;
req.filter = flags;
m_PendingRequests.Enqueue(req);
}
public void QueueRequest(Vector3 position, Vector3 direction, float length, int count, RaycastCallback retMethod)
{
ODERayRequest req = new ODERayRequest();

View File

@ -52,6 +52,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
private static Vector3 SitAjust = new Vector3(0, 0, 0.4f);
private const RayFilterFlags RaySitFlags = RayFilterFlags.AllPrims | RayFilterFlags.ClosestHit;
public void Sit(PhysicsActor actor, Vector3 avPos, Vector3 avCameraPosition, Vector3 offset, Vector3 avOffset, SitAvatarCallback PhysicsSitResponse)
{
@ -96,7 +97,7 @@ namespace OpenSim.Region.Physics.OdePlugin
raylen += 30f; // focal point may be far
List<ContactResult> rayResults;
rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir , raylen, 1);
rayResults = m_scene.RaycastActor(actor, avCameraPosition, rayDir, raylen, 1, RaySitFlags);
if (rayResults.Count == 0 || rayResults[0].ConsumerID != actor.LocalID)
{
d.GeomGetAABB(geom,out aabb);
@ -108,6 +109,7 @@ namespace OpenSim.Region.Physics.OdePlugin
return;
}
offset = rayResults[0].Pos - geopos;
double ang;
float s;
@ -156,13 +158,16 @@ namespace OpenSim.Region.Physics.OdePlugin
return;
}
Vector3 norm = rayResults[0].Normal;
/*
// contact normals aren't reliable on meshs or sculpts it seems
Vector3 norm = rayResults[0].Normal;
if (norm.Z < 0)
{
PhysicsSitResponse(0, actor.LocalID, offset, Quaternion.Identity);
return;
}
if (norm.Z < 0)
{
PhysicsSitResponse(0, actor.LocalID, offset, Quaternion.Identity);
return;
}
*/
ang = Math.Atan2(-rayDir.Y, -rayDir.X);
ang *= 0.5d;