diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 24 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsScene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs | 10 |
3 files changed, 30 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a3ceecb..24840d4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1105,7 +1105,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1105 | /// <param name="collisionPoint"></param> | 1105 | /// <param name="collisionPoint"></param> |
1106 | /// <param name="localid"></param> | 1106 | /// <param name="localid"></param> |
1107 | /// <param name="distance"></param> | 1107 | /// <param name="distance"></param> |
1108 | public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance) | 1108 | public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal) |
1109 | { | 1109 | { |
1110 | const float POSITION_TOLERANCE = 0.02f; | 1110 | const float POSITION_TOLERANCE = 0.02f; |
1111 | const float VELOCITY_TOLERANCE = 0.02f; | 1111 | const float VELOCITY_TOLERANCE = 0.02f; |
@@ -1686,8 +1686,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1686 | 1686 | ||
1687 | bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); | 1687 | bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); |
1688 | bool SitTargetisSet = | 1688 | bool SitTargetisSet = |
1689 | (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 0f && | 1689 | (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && |
1690 | avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f)); | 1690 | ( |
1691 | avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 1f // Valid Zero Rotation quaternion | ||
1692 | || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point | ||
1693 | || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion | ||
1694 | ) | ||
1695 | )); | ||
1691 | 1696 | ||
1692 | if (SitTargetisSet && SitTargetUnOccupied) | 1697 | if (SitTargetisSet && SitTargetUnOccupied) |
1693 | { | 1698 | { |
@@ -1750,7 +1755,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1750 | StandUp(); | 1755 | StandUp(); |
1751 | } | 1756 | } |
1752 | m_nextSitAnimation = "SIT"; | 1757 | m_nextSitAnimation = "SIT"; |
1753 | 1758 | ||
1754 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); | 1759 | //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); |
1755 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); | 1760 | SceneObjectPart part = FindNextAvailableSitTarget(targetID); |
1756 | 1761 | ||
@@ -1762,12 +1767,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
1762 | } | 1767 | } |
1763 | m_requestedSitTargetID = part.LocalId; | 1768 | m_requestedSitTargetID = part.LocalId; |
1764 | //m_requestedSitOffset = offset; | 1769 | //m_requestedSitOffset = offset; |
1770 | //offset.X += part.Scale.X;// *offset.X; | ||
1771 | //offset.Y += part.Scale.Y;// * offset.Y; | ||
1772 | //offset.Z += part.Scale.Z;// * offset.Z; | ||
1773 | //m_requestedSitOffset = offset; | ||
1774 | m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset); | ||
1765 | } | 1775 | } |
1766 | else | 1776 | else |
1767 | { | 1777 | { |
1768 | 1778 | ||
1769 | m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); | 1779 | m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); |
1770 | } | 1780 | } |
1781 | |||
1782 | if (m_scene.PhysicsScene.SupportsRayCast()) | ||
1783 | { | ||
1784 | //m_scene.PhysicsScene.RaycastWorld(Vector3.Zero,Vector3.Zero, 0.01f,new RaycastCallback()); | ||
1785 | } | ||
1786 | |||
1771 | SendSitResponse(remoteClient, targetID, offset); | 1787 | SendSitResponse(remoteClient, targetID, offset); |
1772 | } | 1788 | } |
1773 | 1789 | ||
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 6d515e9..217d307 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Region.Physics.Manager | |||
36 | { | 36 | { |
37 | public delegate void physicsCrash(); | 37 | public delegate void physicsCrash(); |
38 | 38 | ||
39 | public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance); | 39 | public delegate void RaycastCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal); |
40 | 40 | ||
41 | public abstract class PhysicsScene | 41 | public abstract class PhysicsScene |
42 | { | 42 | { |
@@ -204,7 +204,7 @@ namespace OpenSim.Region.Physics.Manager | |||
204 | public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod) | 204 | public virtual void RaycastWorld(Vector3 position, Vector3 direction, float length, RaycastCallback retMethod) |
205 | { | 205 | { |
206 | if (retMethod != null) | 206 | if (retMethod != null) |
207 | retMethod(false, Vector3.Zero, 0, 999999999999f); | 207 | retMethod(false, Vector3.Zero, 0, 999999999999f, Vector3.Zero); |
208 | } | 208 | } |
209 | 209 | ||
210 | private class NullPhysicsScene : PhysicsScene | 210 | private class NullPhysicsScene : PhysicsScene |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs index c8ae229..732e835 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs | |||
@@ -145,6 +145,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
145 | uint hitConsumerID = 0; | 145 | uint hitConsumerID = 0; |
146 | float distance = 999999999999f; | 146 | float distance = 999999999999f; |
147 | Vector3 closestcontact = new Vector3(99999f, 99999f, 99999f); | 147 | Vector3 closestcontact = new Vector3(99999f, 99999f, 99999f); |
148 | Vector3 snormal = Vector3.Zero; | ||
148 | 149 | ||
149 | // Find closest contact and object. | 150 | // Find closest contact and object. |
150 | lock (m_contactResults) | 151 | lock (m_contactResults) |
@@ -157,6 +158,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
157 | hitConsumerID = cResult.ConsumerID; | 158 | hitConsumerID = cResult.ConsumerID; |
158 | distance = cResult.Depth; | 159 | distance = cResult.Depth; |
159 | hitYN = true; | 160 | hitYN = true; |
161 | snormal = cResult.Normal; | ||
160 | } | 162 | } |
161 | } | 163 | } |
162 | 164 | ||
@@ -165,7 +167,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
165 | 167 | ||
166 | // Return results | 168 | // Return results |
167 | if (req.callbackMethod != null) | 169 | if (req.callbackMethod != null) |
168 | req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance); | 170 | req.callbackMethod(hitYN, closestcontact, hitConsumerID, distance, snormal); |
169 | } | 171 | } |
170 | 172 | ||
171 | // This is the standard Near. Uses space AABBs to speed up detection. | 173 | // This is the standard Near. Uses space AABBs to speed up detection. |
@@ -310,7 +312,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
310 | collisionresult.ConsumerID = ((OdePrim)p1).m_localID; | 312 | collisionresult.ConsumerID = ((OdePrim)p1).m_localID; |
311 | collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); | 313 | collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); |
312 | collisionresult.Depth = contacts[i].depth; | 314 | collisionresult.Depth = contacts[i].depth; |
313 | 315 | collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y, | |
316 | contacts[i].normal.Z); | ||
314 | lock (m_contactResults) | 317 | lock (m_contactResults) |
315 | m_contactResults.Add(collisionresult); | 318 | m_contactResults.Add(collisionresult); |
316 | } | 319 | } |
@@ -325,6 +328,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
325 | collisionresult.ConsumerID = ((OdePrim)p2).m_localID; | 328 | collisionresult.ConsumerID = ((OdePrim)p2).m_localID; |
326 | collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); | 329 | collisionresult.Pos = new Vector3(contacts[i].pos.X, contacts[i].pos.Y, contacts[i].pos.Z); |
327 | collisionresult.Depth = contacts[i].depth; | 330 | collisionresult.Depth = contacts[i].depth; |
331 | collisionresult.Normal = new Vector3(contacts[i].normal.X, contacts[i].normal.Y, | ||
332 | contacts[i].normal.Z); | ||
328 | 333 | ||
329 | lock (m_contactResults) | 334 | lock (m_contactResults) |
330 | m_contactResults.Add(collisionresult); | 335 | m_contactResults.Add(collisionresult); |
@@ -358,5 +363,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
358 | public Vector3 Pos; | 363 | public Vector3 Pos; |
359 | public float Depth; | 364 | public float Depth; |
360 | public uint ConsumerID; | 365 | public uint ConsumerID; |
366 | public Vector3 Normal; | ||
361 | } | 367 | } |
362 | } | 368 | } |