diff options
Diffstat (limited to 'OpenSim/Region/Physics/Manager/PhysicsActor.cs')
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 6bfdff2..f58129d 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -52,6 +52,20 @@ namespace OpenSim.Region.Physics.Manager | |||
52 | , Absolute | 52 | , Absolute |
53 | } | 53 | } |
54 | 54 | ||
55 | public struct ContactPoint | ||
56 | { | ||
57 | public Vector3 Position; | ||
58 | public Vector3 SurfaceNormal; | ||
59 | public float PenetrationDepth; | ||
60 | |||
61 | public ContactPoint(Vector3 position, Vector3 surfaceNormal, float penetrationDepth) | ||
62 | { | ||
63 | Position = position; | ||
64 | SurfaceNormal = surfaceNormal; | ||
65 | PenetrationDepth = penetrationDepth; | ||
66 | } | ||
67 | } | ||
68 | |||
55 | public class CollisionEventUpdate : EventArgs | 69 | public class CollisionEventUpdate : EventArgs |
56 | { | 70 | { |
57 | // Raising the event on the object, so don't need to provide location.. further up the tree knows that info. | 71 | // Raising the event on the object, so don't need to provide location.. further up the tree knows that info. |
@@ -59,9 +73,9 @@ namespace OpenSim.Region.Physics.Manager | |||
59 | public int m_colliderType; | 73 | public int m_colliderType; |
60 | public int m_GenericStartEnd; | 74 | public int m_GenericStartEnd; |
61 | //public uint m_LocalID; | 75 | //public uint m_LocalID; |
62 | public Dictionary<uint,float> m_objCollisionList = new Dictionary<uint,float>(); | 76 | public Dictionary<uint, ContactPoint> m_objCollisionList = new Dictionary<uint, ContactPoint>(); |
63 | 77 | ||
64 | public CollisionEventUpdate(uint localID, int colliderType, int GenericStartEnd, Dictionary<uint, float> objCollisionList) | 78 | public CollisionEventUpdate(uint localID, int colliderType, int GenericStartEnd, Dictionary<uint, ContactPoint> objCollisionList) |
65 | { | 79 | { |
66 | m_colliderType = colliderType; | 80 | m_colliderType = colliderType; |
67 | m_GenericStartEnd = GenericStartEnd; | 81 | m_GenericStartEnd = GenericStartEnd; |
@@ -72,8 +86,7 @@ namespace OpenSim.Region.Physics.Manager | |||
72 | { | 86 | { |
73 | m_colliderType = (int) ActorTypes.Unknown; | 87 | m_colliderType = (int) ActorTypes.Unknown; |
74 | m_GenericStartEnd = 1; | 88 | m_GenericStartEnd = 1; |
75 | // m_objCollisionList = null; | 89 | m_objCollisionList = new Dictionary<uint, ContactPoint>(); |
76 | m_objCollisionList = new Dictionary<uint, float>(); | ||
77 | } | 90 | } |
78 | 91 | ||
79 | public int collidertype | 92 | public int collidertype |
@@ -88,16 +101,16 @@ namespace OpenSim.Region.Physics.Manager | |||
88 | set { m_GenericStartEnd = value; } | 101 | set { m_GenericStartEnd = value; } |
89 | } | 102 | } |
90 | 103 | ||
91 | public void addCollider(uint localID, float depth) | 104 | public void addCollider(uint localID, ContactPoint contact) |
92 | { | 105 | { |
93 | if (!m_objCollisionList.ContainsKey(localID)) | 106 | if (!m_objCollisionList.ContainsKey(localID)) |
94 | { | 107 | { |
95 | m_objCollisionList.Add(localID, depth); | 108 | m_objCollisionList.Add(localID, contact); |
96 | } | 109 | } |
97 | else | 110 | else |
98 | { | 111 | { |
99 | if (m_objCollisionList[localID] < depth) | 112 | if (m_objCollisionList[localID].PenetrationDepth < contact.PenetrationDepth) |
100 | m_objCollisionList[localID] = depth; | 113 | m_objCollisionList[localID] = contact; |
101 | } | 114 | } |
102 | } | 115 | } |
103 | } | 116 | } |