aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/POSPlugin
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-25 23:16:12 -0700
committerJohn Hurliman2009-10-26 18:23:43 -0700
commitd199767e6991d6f368661fce9c5a072e564b8a4b (patch)
treed9347b8a424c0164e208f908613aa8fe1511444b /OpenSim/Region/Physics/POSPlugin
parent* Double the priority on avatar bake texture requests to get avatars rezzing ... (diff)
downloadopensim-SC_OLD-d199767e6991d6f368661fce9c5a072e564b8a4b.zip
opensim-SC_OLD-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.gz
opensim-SC_OLD-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.bz2
opensim-SC_OLD-d199767e6991d6f368661fce9c5a072e564b8a4b.tar.xz
Experimental change of PhysicsVector to Vector3. Untested
Diffstat (limited to 'OpenSim/Region/Physics/POSPlugin')
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSCharacter.cs55
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPrim.cs53
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSScene.cs52
3 files changed, 79 insertions, 81 deletions
diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
index 35fc616..26cd1dd 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs
@@ -36,20 +36,17 @@ namespace OpenSim.Region.Physics.POSPlugin
36{ 36{
37 public class POSCharacter : PhysicsActor 37 public class POSCharacter : PhysicsActor
38 { 38 {
39 private PhysicsVector _position; 39 private Vector3 _position;
40 public PhysicsVector _velocity; 40 public Vector3 _velocity;
41 public PhysicsVector _target_velocity = PhysicsVector.Zero; 41 public Vector3 _target_velocity = Vector3.Zero;
42 public PhysicsVector _size = PhysicsVector.Zero; 42 public Vector3 _size = Vector3.Zero;
43 private PhysicsVector _acceleration; 43 private Vector3 _acceleration;
44 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 44 private Vector3 m_rotationalVelocity = Vector3.Zero;
45 private bool flying; 45 private bool flying;
46 private bool isColliding; 46 private bool isColliding;
47 47
48 public POSCharacter() 48 public POSCharacter()
49 { 49 {
50 _velocity = new PhysicsVector();
51 _position = new PhysicsVector();
52 _acceleration = new PhysicsVector();
53 } 50 }
54 51
55 public override int PhysicsActorType 52 public override int PhysicsActorType
@@ -58,7 +55,7 @@ namespace OpenSim.Region.Physics.POSPlugin
58 set { return; } 55 set { return; }
59 } 56 }
60 57
61 public override PhysicsVector RotationalVelocity 58 public override Vector3 RotationalVelocity
62 { 59 {
63 get { return m_rotationalVelocity; } 60 get { return m_rotationalVelocity; }
64 set { m_rotationalVelocity = value; } 61 set { m_rotationalVelocity = value; }
@@ -137,13 +134,13 @@ namespace OpenSim.Region.Physics.POSPlugin
137 get { return false; } 134 get { return false; }
138 } 135 }
139 136
140 public override PhysicsVector Position 137 public override Vector3 Position
141 { 138 {
142 get { return _position; } 139 get { return _position; }
143 set { _position = value; } 140 set { _position = value; }
144 } 141 }
145 142
146 public override PhysicsVector Size 143 public override Vector3 Size
147 { 144 {
148 get { return _size; } 145 get { return _size; }
149 set 146 set
@@ -158,9 +155,9 @@ namespace OpenSim.Region.Physics.POSPlugin
158 get { return 0f; } 155 get { return 0f; }
159 } 156 }
160 157
161 public override PhysicsVector Force 158 public override Vector3 Force
162 { 159 {
163 get { return PhysicsVector.Zero; } 160 get { return Vector3.Zero; }
164 set { return; } 161 set { return; }
165 } 162 }
166 163
@@ -175,7 +172,7 @@ namespace OpenSim.Region.Physics.POSPlugin
175 172
176 } 173 }
177 174
178 public override void VehicleVectorParam(int param, PhysicsVector value) 175 public override void VehicleVectorParam(int param, Vector3 value)
179 { 176 {
180 177
181 } 178 }
@@ -190,14 +187,14 @@ namespace OpenSim.Region.Physics.POSPlugin
190 187
191 } 188 }
192 189
193 public override PhysicsVector CenterOfMass 190 public override Vector3 CenterOfMass
194 { 191 {
195 get { return PhysicsVector.Zero; } 192 get { return Vector3.Zero; }
196 } 193 }
197 194
198 public override PhysicsVector GeometricCenter 195 public override Vector3 GeometricCenter
199 { 196 {
200 get { return PhysicsVector.Zero; } 197 get { return Vector3.Zero; }
201 } 198 }
202 199
203 public override PrimitiveBaseShape Shape 200 public override PrimitiveBaseShape Shape
@@ -205,15 +202,15 @@ namespace OpenSim.Region.Physics.POSPlugin
205 set { return; } 202 set { return; }
206 } 203 }
207 204
208 public override PhysicsVector Velocity 205 public override Vector3 Velocity
209 { 206 {
210 get { return _velocity; } 207 get { return _velocity; }
211 set { _target_velocity = value; } 208 set { _target_velocity = value; }
212 } 209 }
213 210
214 public override PhysicsVector Torque 211 public override Vector3 Torque
215 { 212 {
216 get { return PhysicsVector.Zero; } 213 get { return Vector3.Zero; }
217 set { return; } 214 set { return; }
218 } 215 }
219 216
@@ -229,7 +226,7 @@ namespace OpenSim.Region.Physics.POSPlugin
229 set { } 226 set { }
230 } 227 }
231 228
232 public override PhysicsVector Acceleration 229 public override Vector3 Acceleration
233 { 230 {
234 get { return _acceleration; } 231 get { return _acceleration; }
235 } 232 }
@@ -248,24 +245,24 @@ namespace OpenSim.Region.Physics.POSPlugin
248 { 245 {
249 } 246 }
250 247
251 public override void LockAngularMotion(PhysicsVector axis) 248 public override void LockAngularMotion(Vector3 axis)
252 { 249 {
253 } 250 }
254 251
255 public void SetAcceleration(PhysicsVector accel) 252 public void SetAcceleration(Vector3 accel)
256 { 253 {
257 _acceleration = accel; 254 _acceleration = accel;
258 } 255 }
259 256
260 public override void AddForce(PhysicsVector force, bool pushforce) 257 public override void AddForce(Vector3 force, bool pushforce)
261 { 258 {
262 } 259 }
263 260
264 public override void AddAngularForce(PhysicsVector force, bool pushforce) 261 public override void AddAngularForce(Vector3 force, bool pushforce)
265 { 262 {
266 } 263 }
267 264
268 public override void SetMomentum(PhysicsVector momentum) 265 public override void SetMomentum(Vector3 momentum)
269 { 266 {
270 } 267 }
271 268
@@ -273,7 +270,7 @@ namespace OpenSim.Region.Physics.POSPlugin
273 { 270 {
274 } 271 }
275 272
276 public override PhysicsVector PIDTarget 273 public override Vector3 PIDTarget
277 { 274 {
278 set { return; } 275 set { return; }
279 } 276 }
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
index b50364b..96c3e26 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPrim.cs
@@ -36,19 +36,16 @@ namespace OpenSim.Region.Physics.POSPlugin
36{ 36{
37 public class POSPrim : PhysicsActor 37 public class POSPrim : PhysicsActor
38 { 38 {
39 private PhysicsVector _position; 39 private Vector3 _position;
40 private PhysicsVector _velocity; 40 private Vector3 _velocity;
41 private PhysicsVector _acceleration; 41 private Vector3 _acceleration;
42 private PhysicsVector _size; 42 private Vector3 _size;
43 private PhysicsVector m_rotationalVelocity = PhysicsVector.Zero; 43 private Vector3 m_rotationalVelocity = Vector3.Zero;
44 private Quaternion _orientation; 44 private Quaternion _orientation;
45 private bool iscolliding; 45 private bool iscolliding;
46 46
47 public POSPrim() 47 public POSPrim()
48 { 48 {
49 _velocity = new PhysicsVector();
50 _position = new PhysicsVector();
51 _acceleration = new PhysicsVector();
52 } 49 }
53 50
54 public override int PhysicsActorType 51 public override int PhysicsActorType
@@ -57,7 +54,7 @@ namespace OpenSim.Region.Physics.POSPlugin
57 set { return; } 54 set { return; }
58 } 55 }
59 56
60 public override PhysicsVector RotationalVelocity 57 public override Vector3 RotationalVelocity
61 { 58 {
62 get { return m_rotationalVelocity; } 59 get { return m_rotationalVelocity; }
63 set { m_rotationalVelocity = value; } 60 set { m_rotationalVelocity = value; }
@@ -98,13 +95,13 @@ namespace OpenSim.Region.Physics.POSPlugin
98 get { return false; } 95 get { return false; }
99 } 96 }
100 97
101 public override PhysicsVector Position 98 public override Vector3 Position
102 { 99 {
103 get { return _position; } 100 get { return _position; }
104 set { _position = value; } 101 set { _position = value; }
105 } 102 }
106 103
107 public override PhysicsVector Size 104 public override Vector3 Size
108 { 105 {
109 get { return _size; } 106 get { return _size; }
110 set { _size = value; } 107 set { _size = value; }
@@ -115,9 +112,9 @@ namespace OpenSim.Region.Physics.POSPlugin
115 get { return 0f; } 112 get { return 0f; }
116 } 113 }
117 114
118 public override PhysicsVector Force 115 public override Vector3 Force
119 { 116 {
120 get { return PhysicsVector.Zero; } 117 get { return Vector3.Zero; }
121 set { return; } 118 set { return; }
122 } 119 }
123 120
@@ -132,7 +129,7 @@ namespace OpenSim.Region.Physics.POSPlugin
132 129
133 } 130 }
134 131
135 public override void VehicleVectorParam(int param, PhysicsVector value) 132 public override void VehicleVectorParam(int param, Vector3 value)
136 { 133 {
137 134
138 } 135 }
@@ -147,14 +144,14 @@ namespace OpenSim.Region.Physics.POSPlugin
147 144
148 } 145 }
149 146
150 public override PhysicsVector CenterOfMass 147 public override Vector3 CenterOfMass
151 { 148 {
152 get { return PhysicsVector.Zero; } 149 get { return Vector3.Zero; }
153 } 150 }
154 151
155 public override PhysicsVector GeometricCenter 152 public override Vector3 GeometricCenter
156 { 153 {
157 get { return PhysicsVector.Zero; } 154 get { return Vector3.Zero; }
158 } 155 }
159 156
160 public override PrimitiveBaseShape Shape 157 public override PrimitiveBaseShape Shape
@@ -173,7 +170,7 @@ namespace OpenSim.Region.Physics.POSPlugin
173 set { return; } 170 set { return; }
174 } 171 }
175 172
176 public override PhysicsVector Velocity 173 public override Vector3 Velocity
177 { 174 {
178 get { return _velocity; } 175 get { return _velocity; }
179 set { _velocity = value; } 176 set { _velocity = value; }
@@ -191,7 +188,7 @@ namespace OpenSim.Region.Physics.POSPlugin
191 set { _orientation = value; } 188 set { _orientation = value; }
192 } 189 }
193 190
194 public override PhysicsVector Acceleration 191 public override Vector3 Acceleration
195 { 192 {
196 get { return _acceleration; } 193 get { return _acceleration; }
197 } 194 }
@@ -202,26 +199,26 @@ namespace OpenSim.Region.Physics.POSPlugin
202 set { } 199 set { }
203 } 200 }
204 201
205 public void SetAcceleration(PhysicsVector accel) 202 public void SetAcceleration(Vector3 accel)
206 { 203 {
207 _acceleration = accel; 204 _acceleration = accel;
208 } 205 }
209 206
210 public override void AddForce(PhysicsVector force, bool pushforce) 207 public override void AddForce(Vector3 force, bool pushforce)
211 { 208 {
212 } 209 }
213 210
214 public override void AddAngularForce(PhysicsVector force, bool pushforce) 211 public override void AddAngularForce(Vector3 force, bool pushforce)
215 { 212 {
216 } 213 }
217 214
218 public override PhysicsVector Torque 215 public override Vector3 Torque
219 { 216 {
220 get { return PhysicsVector.Zero; } 217 get { return Vector3.Zero; }
221 set { return; } 218 set { return; }
222 } 219 }
223 220
224 public override void SetMomentum(PhysicsVector momentum) 221 public override void SetMomentum(Vector3 momentum)
225 { 222 {
226 } 223 }
227 224
@@ -255,7 +252,7 @@ namespace OpenSim.Region.Physics.POSPlugin
255 { 252 {
256 } 253 }
257 254
258 public override void LockAngularMotion(PhysicsVector axis) 255 public override void LockAngularMotion(Vector3 axis)
259 { 256 {
260 } 257 }
261 258
@@ -268,7 +265,7 @@ namespace OpenSim.Region.Physics.POSPlugin
268 { 265 {
269 } 266 }
270 267
271 public override PhysicsVector PIDTarget 268 public override Vector3 PIDTarget
272 { 269 {
273 set { return; } 270 set { return; }
274 } 271 }
diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
index fa8cc70..c3f5040 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSScene.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.POSPlugin
56 { 56 {
57 } 57 }
58 58
59 public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size, bool isFlying) 59 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
60 { 60 {
61 POSCharacter act = new POSCharacter(); 61 POSCharacter act = new POSCharacter();
62 act.Position = position; 62 act.Position = position;
@@ -84,20 +84,20 @@ namespace OpenSim.Region.Physics.POSPlugin
84 } 84 }
85 85
86/* 86/*
87 public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) 87 public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
88 { 88 {
89 return null; 89 return null;
90 } 90 }
91*/ 91*/
92 92
93 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 93 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
94 PhysicsVector size, Quaternion rotation) 94 Vector3 size, Quaternion rotation)
95 { 95 {
96 return AddPrimShape(primName, pbs, position, size, rotation, false); 96 return AddPrimShape(primName, pbs, position, size, rotation, false);
97 } 97 }
98 98
99 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, PhysicsVector position, 99 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
100 PhysicsVector size, Quaternion rotation, bool isPhysical) 100 Vector3 size, Quaternion rotation, bool isPhysical)
101 { 101 {
102 POSPrim prim = new POSPrim(); 102 POSPrim prim = new POSPrim();
103 prim.Position = position; 103 prim.Position = position;
@@ -152,23 +152,25 @@ namespace OpenSim.Region.Physics.POSPlugin
152 character._target_velocity.Z += gravity * timeStep; 152 character._target_velocity.Z += gravity * timeStep;
153 } 153 }
154 154
155 character.Position.X += character._target_velocity.X * timeStep; 155 Vector3 characterPosition = character.Position;
156 character.Position.Y += character._target_velocity.Y * timeStep;
157 156
158 character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f); 157 characterPosition.X += character._target_velocity.X * timeStep;
159 character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f); 158 characterPosition.Y += character._target_velocity.Y * timeStep;
159
160 characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
161 characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
160 162
161 bool forcedZ = false; 163 bool forcedZ = false;
162 164
163 float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X]; 165 float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X];
164 if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2) 166 if (character.Position.Z + (character._target_velocity.Z * timeStep) < terrainheight + 2)
165 { 167 {
166 character.Position.Z = terrainheight + character.Size.Z; 168 characterPosition.Z = terrainheight + character.Size.Z;
167 forcedZ = true; 169 forcedZ = true;
168 } 170 }
169 else 171 else
170 { 172 {
171 character.Position.Z += character._target_velocity.Z*timeStep; 173 characterPosition.Z += character._target_velocity.Z*timeStep;
172 } 174 }
173 175
174 /// this is it -- the magic you've all been waiting for! Ladies and gentlemen -- 176 /// this is it -- the magic you've all been waiting for! Ladies and gentlemen --
@@ -177,29 +179,29 @@ namespace OpenSim.Region.Physics.POSPlugin
177 179
178 if (isCollidingWithPrim(character)) 180 if (isCollidingWithPrim(character))
179 { 181 {
180 character.Position.Z = oldposZ; // first try Z axis 182 characterPosition.Z = oldposZ; // first try Z axis
181 if (isCollidingWithPrim(character)) 183 if (isCollidingWithPrim(character))
182 { 184 {
183 character.Position.Z = oldposZ + character.Size.Z / 4.4f; // try harder 185 characterPosition.Z = oldposZ + character.Size.Z / 4.4f; // try harder
184 if (isCollidingWithPrim(character)) 186 if (isCollidingWithPrim(character))
185 { 187 {
186 character.Position.Z = oldposZ + character.Size.Z / 2.2f; // try very hard 188 characterPosition.Z = oldposZ + character.Size.Z / 2.2f; // try very hard
187 if (isCollidingWithPrim(character)) 189 if (isCollidingWithPrim(character))
188 { 190 {
189 character.Position.X = oldposX; 191 characterPosition.X = oldposX;
190 character.Position.Y = oldposY; 192 characterPosition.Y = oldposY;
191 character.Position.Z = oldposZ; 193 characterPosition.Z = oldposZ;
192 194
193 character.Position.X += character._target_velocity.X * timeStep; 195 characterPosition.X += character._target_velocity.X * timeStep;
194 if (isCollidingWithPrim(character)) 196 if (isCollidingWithPrim(character))
195 { 197 {
196 character.Position.X = oldposX; 198 characterPosition.X = oldposX;
197 } 199 }
198 200
199 character.Position.Y += character._target_velocity.Y * timeStep; 201 characterPosition.Y += character._target_velocity.Y * timeStep;
200 if (isCollidingWithPrim(character)) 202 if (isCollidingWithPrim(character))
201 { 203 {
202 character.Position.Y = oldposY; 204 characterPosition.Y = oldposY;
203 } 205 }
204 } 206 }
205 else 207 else
@@ -218,8 +220,10 @@ namespace OpenSim.Region.Physics.POSPlugin
218 } 220 }
219 } 221 }
220 222
221 character.Position.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f); 223 characterPosition.X = Util.Clamp(character.Position.X, 0.01f, Constants.RegionSize - 0.01f);
222 character.Position.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f); 224 characterPosition.Y = Util.Clamp(character.Position.Y, 0.01f, Constants.RegionSize - 0.01f);
225
226 character.Position = characterPosition;
223 227
224 character._velocity.X = (character.Position.X - oldposX)/timeStep; 228 character._velocity.X = (character.Position.X - oldposX)/timeStep;
225 character._velocity.Y = (character.Position.Y - oldposY)/timeStep; 229 character._velocity.Y = (character.Position.Y - oldposY)/timeStep;