diff options
Diffstat (limited to 'OpenSim/Region/Physics/Manager/PhysicsActor.cs')
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 87 |
1 files changed, 85 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index 9ce7cf3..49760da 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -27,6 +27,8 @@ | |||
27 | */ | 27 | */ |
28 | using Axiom.Math; | 28 | using Axiom.Math; |
29 | using OpenSim.Framework; | 29 | using OpenSim.Framework; |
30 | using System; | ||
31 | using System.Collections.Generic; | ||
30 | 32 | ||
31 | namespace OpenSim.Region.Physics.Manager | 33 | namespace OpenSim.Region.Physics.Manager |
32 | { | 34 | { |
@@ -35,20 +37,75 @@ namespace OpenSim.Region.Physics.Manager | |||
35 | public delegate void VelocityUpdate(PhysicsVector velocity); | 37 | public delegate void VelocityUpdate(PhysicsVector velocity); |
36 | 38 | ||
37 | public delegate void OrientationUpdate(Quaternion orientation); | 39 | public delegate void OrientationUpdate(Quaternion orientation); |
40 | public enum ActorTypes : int | ||
41 | { | ||
42 | Unknown = 0, | ||
43 | Agent = 1, | ||
44 | Prim = 2, | ||
45 | Ground = 3 | ||
46 | } | ||
47 | public class CollisionEventUpdate : EventArgs | ||
48 | { | ||
49 | // Raising the event on the object, so don't need to provide location.. further up the tree knows that info. | ||
38 | 50 | ||
39 | 51 | ||
52 | public int m_colliderType; | ||
53 | public bool m_startOrEnd; | ||
54 | //public uint m_LocalID; | ||
55 | public List<uint> m_objCollisionList; | ||
56 | public CollisionEventUpdate(uint localID, int colliderType, bool startOrEnd, List<uint> objCollisionList) | ||
57 | { | ||
58 | m_colliderType = colliderType; | ||
59 | m_startOrEnd = startOrEnd; | ||
60 | m_objCollisionList = objCollisionList; | ||
61 | |||
62 | } | ||
63 | public CollisionEventUpdate(bool startOrEnd){ | ||
64 | m_colliderType = (int)ActorTypes.Unknown; | ||
65 | m_startOrEnd = startOrEnd; | ||
66 | m_objCollisionList = null; | ||
67 | } | ||
68 | public CollisionEventUpdate() { | ||
69 | m_colliderType = (int)ActorTypes.Unknown; | ||
70 | m_startOrEnd = false; | ||
71 | m_objCollisionList = null; | ||
72 | } | ||
73 | public int collidertype{ | ||
74 | get { | ||
75 | return m_colliderType; | ||
76 | } | ||
77 | set { | ||
78 | m_colliderType = value; | ||
79 | } | ||
80 | } | ||
81 | public bool startOrEnd { | ||
82 | get { | ||
83 | return m_startOrEnd; | ||
84 | } | ||
85 | set { | ||
86 | m_startOrEnd = value; | ||
87 | } | ||
88 | } | ||
89 | public void addCollider(uint localID) { | ||
90 | m_objCollisionList.Add(localID); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | |||
40 | 95 | ||
41 | 96 | ||
42 | 97 | ||
43 | public abstract class PhysicsActor | 98 | public abstract class PhysicsActor |
44 | { | 99 | { |
45 | public delegate void RequestTerseUpdate(); | 100 | public delegate void RequestTerseUpdate(); |
101 | public delegate void CollisionUpdate(EventArgs e); | ||
46 | 102 | ||
47 | #pragma warning disable 67 | 103 | #pragma warning disable 67 |
48 | public event PositionUpdate OnPositionUpdate; | 104 | public event PositionUpdate OnPositionUpdate; |
49 | public event VelocityUpdate OnVelocityUpdate; | 105 | public event VelocityUpdate OnVelocityUpdate; |
50 | public event OrientationUpdate OnOrientationUpdate; | 106 | public event OrientationUpdate OnOrientationUpdate; |
51 | public event RequestTerseUpdate OnRequestTerseUpdate; | 107 | public event RequestTerseUpdate OnRequestTerseUpdate; |
108 | public event CollisionUpdate OnCollisionUpdate; | ||
52 | #pragma warning restore 67 | 109 | #pragma warning restore 67 |
53 | 110 | ||
54 | public static PhysicsActor Null | 111 | public static PhysicsActor Null |
@@ -74,6 +131,14 @@ namespace OpenSim.Region.Physics.Manager | |||
74 | } | 131 | } |
75 | 132 | ||
76 | } | 133 | } |
134 | public virtual void SendCollisionUpdate(EventArgs e) | ||
135 | { | ||
136 | CollisionUpdate handler = OnCollisionUpdate; | ||
137 | if (handler != null) | ||
138 | { | ||
139 | OnCollisionUpdate(e); | ||
140 | } | ||
141 | } | ||
77 | 142 | ||
78 | 143 | ||
79 | public abstract PhysicsVector Position { get; set; } | 144 | public abstract PhysicsVector Position { get; set; } |
@@ -83,6 +148,7 @@ namespace OpenSim.Region.Physics.Manager | |||
83 | public abstract PhysicsVector Acceleration { get; } | 148 | public abstract PhysicsVector Acceleration { get; } |
84 | 149 | ||
85 | public abstract Quaternion Orientation { get; set; } | 150 | public abstract Quaternion Orientation { get; set; } |
151 | public abstract int PhysicsActorType { get; set; } | ||
86 | 152 | ||
87 | public abstract bool IsPhysical {get; set;} | 153 | public abstract bool IsPhysical {get; set;} |
88 | 154 | ||
@@ -91,6 +157,9 @@ namespace OpenSim.Region.Physics.Manager | |||
91 | public abstract bool ThrottleUpdates { get; set; } | 157 | public abstract bool ThrottleUpdates { get; set; } |
92 | 158 | ||
93 | public abstract bool IsColliding { get; set; } | 159 | public abstract bool IsColliding { get; set; } |
160 | public abstract bool CollidingGround { get; set; } | ||
161 | public abstract bool CollidingObj { get; set; } | ||
162 | |||
94 | public abstract PhysicsVector RotationalVelocity { get; set; } | 163 | public abstract PhysicsVector RotationalVelocity { get; set; } |
95 | 164 | ||
96 | public abstract bool Kinematic { get; set; } | 165 | public abstract bool Kinematic { get; set; } |
@@ -107,7 +176,16 @@ namespace OpenSim.Region.Physics.Manager | |||
107 | get { return PhysicsVector.Zero; } | 176 | get { return PhysicsVector.Zero; } |
108 | set { return; } | 177 | set { return; } |
109 | } | 178 | } |
110 | 179 | public override bool CollidingGround | |
180 | { | ||
181 | get {return false;} | ||
182 | set {return;} | ||
183 | } | ||
184 | public override bool CollidingObj | ||
185 | { | ||
186 | get { return false; } | ||
187 | set { return; } | ||
188 | } | ||
111 | public override PhysicsVector Size | 189 | public override PhysicsVector Size |
112 | { | 190 | { |
113 | get { return PhysicsVector.Zero; } | 191 | get { return PhysicsVector.Zero; } |
@@ -161,6 +239,11 @@ namespace OpenSim.Region.Physics.Manager | |||
161 | get { return false; } | 239 | get { return false; } |
162 | set { return; } | 240 | set { return; } |
163 | } | 241 | } |
242 | public override int PhysicsActorType | ||
243 | { | ||
244 | get { return (int)ActorTypes.Unknown; } | ||
245 | set { return; } | ||
246 | } | ||
164 | 247 | ||
165 | public override bool Kinematic | 248 | public override bool Kinematic |
166 | { | 249 | { |