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, RaycastCallback retMethod){}
public virtual void RaycastActor(PhysicsActor actor, Vector3 position, Vector3 direction, float length, int Count, RayCallback 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>(); return new List<ContactResult>();
} }

View File

@ -199,6 +199,20 @@ namespace OpenSim.Region.Physics.OdePlugin
m_PendingRequests.Enqueue(req); 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) public void QueueRequest(Vector3 position, Vector3 direction, float length, int count, RaycastCallback retMethod)
{ {
ODERayRequest req = new ODERayRequest(); 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 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) 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 raylen += 30f; // focal point may be far
List<ContactResult> rayResults; 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) if (rayResults.Count == 0 || rayResults[0].ConsumerID != actor.LocalID)
{ {
d.GeomGetAABB(geom,out aabb); d.GeomGetAABB(geom,out aabb);
@ -108,6 +109,7 @@ namespace OpenSim.Region.Physics.OdePlugin
return; return;
} }
offset = rayResults[0].Pos - geopos; offset = rayResults[0].Pos - geopos;
double ang; double ang;
float s; float s;
@ -156,6 +158,8 @@ namespace OpenSim.Region.Physics.OdePlugin
return; return;
} }
/*
// contact normals aren't reliable on meshs or sculpts it seems
Vector3 norm = rayResults[0].Normal; Vector3 norm = rayResults[0].Normal;
if (norm.Z < 0) if (norm.Z < 0)
@ -163,6 +167,7 @@ namespace OpenSim.Region.Physics.OdePlugin
PhysicsSitResponse(0, actor.LocalID, offset, Quaternion.Identity); PhysicsSitResponse(0, actor.LocalID, offset, Quaternion.Identity);
return; return;
} }
*/
ang = Math.Atan2(-rayDir.Y, -rayDir.X); ang = Math.Atan2(-rayDir.Y, -rayDir.X);
ang *= 0.5d; ang *= 0.5d;