mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 17:55:48 +08:00
* Adds Normal to the fields returned by the Physics Raycaster
* Fixes recognizing when a sit target is and isn't set. * * 1. Vector3.Zero. * * 2. Orientation: x:0, y:0, z:0, w:1 - ZERO_ROTATION * * (or) Orientation: x:0, y:0, z:0, w:0 - Invalid Quaternion * * (or) Orientation: x:0, y:0, z:1, w:0 - Invalid mapping, some older objects still exist with it
This commit is contained in:
@@ -36,7 +36,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||
{
|
||||
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
|
||||
{
|
||||
@@ -204,7 +204,7 @@ namespace OpenSim.Region.Physics.Manager
|
||||
public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod)
|
||||
{
|
||||
if (retMethod != null)
|
||||
retMethod(false, Vector3.Zero, 0, 999999999999f);
|
||||
retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero);
|
||||
}
|
||||
|
||||
private class NullPhysicsScene : PhysicsScene
|
||||
|
||||
@@ -145,6 +145,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
uint hitConsumerID = 0;
|
||||
float distance = 999999999999f;
|
||||
Vector3 closestcontact = new Vector3(99999f, 99999f, 99999f);
|
||||
Vector3 snormal = Vector3.Zero;
|
||||
|
||||
// Find closest contact and object.
|
||||
lock (m_contactResults)
|
||||
@@ -157,6 +158,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
hitConsumerID = cResult.ConsumerID;
|
||||
distance = cResult.Depth;
|
||||
hitYN = true;
|
||||
snormal = cResult.Normal;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +167,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
|
||||
// Return results
|
||||
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.
|
||||
@@ -310,7 +312,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
collisionresult.ConsumerID = ((OdePrim)p1).m_localID;
|
||||
collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
|
||||
collisionresult.Depth = contacts[i].depth;
|
||||
|
||||
collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
|
||||
contacts[i].normal.Z);
|
||||
lock (m_contactResults)
|
||||
m_contactResults.Add(collisionresult);
|
||||
}
|
||||
@@ -325,6 +328,8 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
collisionresult.ConsumerID = ((OdePrim)p2).m_localID;
|
||||
collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z);
|
||||
collisionresult.Depth = contacts[i].depth;
|
||||
collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y,
|
||||
contacts[i].normal.Z);
|
||||
|
||||
lock (m_contactResults)
|
||||
m_contactResults.Add(collisionresult);
|
||||
@@ -358,5 +363,6 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||
public Vector3 Pos;
|
||||
public float Depth;
|
||||
public uint ConsumerID;
|
||||
public Vector3 Normal;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user