diff options
author | lbsa71 | 2007-12-27 21:41:48 +0000 |
---|---|---|
committer | lbsa71 | 2007-12-27 21:41:48 +0000 |
commit | efd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch) | |
tree | bf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |
parent | * removed always true if (diff) | |
download | opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2 opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz |
* Optimized usings
* shortened references
* Removed redundant 'this'
* Normalized EOF
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 175 |
1 files changed, 78 insertions, 97 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 35328b8..5fef47d 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -27,16 +27,13 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | ||
31 | using Axiom.Math; | 30 | using Axiom.Math; |
32 | using Ode.NET; | 31 | using Ode.NET; |
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.Physics.Manager; |
36 | 34 | ||
37 | namespace OpenSim.Region.Physics.OdePlugin | 35 | namespace OpenSim.Region.Physics.OdePlugin |
38 | { | 36 | { |
39 | |||
40 | public class OdePrim : PhysicsActor | 37 | public class OdePrim : PhysicsActor |
41 | { | 38 | { |
42 | public PhysicsVector _position; | 39 | public PhysicsVector _position; |
@@ -57,7 +54,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
57 | private IMesh _mesh; | 54 | private IMesh _mesh; |
58 | private PrimitiveBaseShape _pbs; | 55 | private PrimitiveBaseShape _pbs; |
59 | private OdeScene _parent_scene; | 56 | private OdeScene _parent_scene; |
60 | public IntPtr m_targetSpace = (IntPtr)0; | 57 | public IntPtr m_targetSpace = (IntPtr) 0; |
61 | public IntPtr prim_geom; | 58 | public IntPtr prim_geom; |
62 | public IntPtr _triMeshData; | 59 | public IntPtr _triMeshData; |
63 | private bool iscolliding = false; | 60 | private bool iscolliding = false; |
@@ -65,18 +62,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
65 | private bool m_throttleUpdates = false; | 62 | private bool m_throttleUpdates = false; |
66 | private int throttleCounter = 0; | 63 | private int throttleCounter = 0; |
67 | public bool outofBounds = false; | 64 | public bool outofBounds = false; |
68 | private float m_density = 10.000006836f;// Aluminum g/cm3; | 65 | private float m_density = 10.000006836f; // Aluminum g/cm3; |
69 | 66 | ||
70 | |||
71 | 67 | ||
72 | public bool _zeroFlag = false; | 68 | public bool _zeroFlag = false; |
73 | private bool m_lastUpdateSent = false; | 69 | private bool m_lastUpdateSent = false; |
74 | 70 | ||
75 | public IntPtr Body = (IntPtr)0; | 71 | public IntPtr Body = (IntPtr) 0; |
76 | private String m_primName; | 72 | private String m_primName; |
77 | private PhysicsVector _target_velocity; | 73 | private PhysicsVector _target_velocity; |
78 | public d.Mass pMass; | 74 | public d.Mass pMass; |
79 | 75 | ||
80 | private int debugcounter = 0; | 76 | private int debugcounter = 0; |
81 | 77 | ||
82 | public OdePrim(String primName, OdeScene parent_scene, IntPtr targetSpace, PhysicsVector pos, PhysicsVector size, | 78 | public OdePrim(String primName, OdeScene parent_scene, IntPtr targetSpace, PhysicsVector pos, PhysicsVector size, |
@@ -123,7 +119,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
123 | // linksets *should* be in a space together.. but are not currently | 119 | // linksets *should* be in a space together.. but are not currently |
124 | if (m_isphysical) | 120 | if (m_isphysical) |
125 | m_targetSpace = _parent_scene.space; | 121 | m_targetSpace = _parent_scene.space; |
126 | |||
127 | } | 122 | } |
128 | m_primName = primName; | 123 | m_primName = primName; |
129 | 124 | ||
@@ -147,25 +142,28 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
147 | d.GeomSetQuaternion(prim_geom, ref myrot); | 142 | d.GeomSetQuaternion(prim_geom, ref myrot); |
148 | 143 | ||
149 | 144 | ||
150 | if (m_isphysical && Body == (IntPtr)0) | 145 | if (m_isphysical && Body == (IntPtr) 0) |
151 | { | 146 | { |
152 | enableBody(); | 147 | enableBody(); |
153 | } | 148 | } |
154 | parent_scene.geom_name_map[prim_geom] = primName; | 149 | parent_scene.geom_name_map[prim_geom] = primName; |
155 | parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this; | 150 | parent_scene.actor_name_map[prim_geom] = (PhysicsActor) this; |
156 | // don't do .add() here; old geoms get recycled with the same hash | 151 | // don't do .add() here; old geoms get recycled with the same hash |
157 | } | 152 | } |
158 | } | 153 | } |
154 | |||
159 | public override int PhysicsActorType | 155 | public override int PhysicsActorType |
160 | { | 156 | { |
161 | get { return (int)ActorTypes.Prim; } | 157 | get { return (int) ActorTypes.Prim; } |
162 | set { return; } | 158 | set { return; } |
163 | } | 159 | } |
160 | |||
164 | public override bool SetAlwaysRun | 161 | public override bool SetAlwaysRun |
165 | { | 162 | { |
166 | get { return false; } | 163 | get { return false; } |
167 | set { return; } | 164 | set { return; } |
168 | } | 165 | } |
166 | |||
169 | public void enableBody() | 167 | public void enableBody() |
170 | { | 168 | { |
171 | // Sets the geom to a body | 169 | // Sets the geom to a body |
@@ -185,13 +183,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
185 | 183 | ||
186 | _parent_scene.addActivePrim(this); | 184 | _parent_scene.addActivePrim(this); |
187 | } | 185 | } |
186 | |||
188 | private float CalculateMass() | 187 | private float CalculateMass() |
189 | { | 188 | { |
190 | float volume = 0; | 189 | float volume = 0; |
191 | 190 | ||
192 | // No material is passed to the physics engines yet.. soo.. | 191 | // No material is passed to the physics engines yet.. soo.. |
193 | // we're using the m_density constant in the class definition | 192 | // we're using the m_density constant in the class definition |
194 | 193 | ||
195 | 194 | ||
196 | float returnMass = 0; | 195 | float returnMass = 0; |
197 | 196 | ||
@@ -199,17 +198,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
199 | { | 198 | { |
200 | case ProfileShape.Square: | 199 | case ProfileShape.Square: |
201 | // Profile Volume | 200 | // Profile Volume |
202 | 201 | ||
203 | volume = _size.X * _size.Y * _size.Z; | 202 | volume = _size.X*_size.Y*_size.Z; |
204 | 203 | ||
205 | // If the user has 'hollowed out' | 204 | // If the user has 'hollowed out' |
206 | // ProfileHollow is one of those 0 to 50000 values :P | 205 | // ProfileHollow is one of those 0 to 50000 values :P |
207 | // we like percentages better.. so turning into a percentage | 206 | // we like percentages better.. so turning into a percentage |
208 | 207 | ||
209 | if (((float)_pbs.ProfileHollow / 50000f) > 0.0) | 208 | if (((float) _pbs.ProfileHollow/50000f) > 0.0) |
210 | { | 209 | { |
211 | float hollowAmount = (float)_pbs.ProfileHollow / 50000f; | 210 | float hollowAmount = (float) _pbs.ProfileHollow/50000f; |
212 | 211 | ||
213 | // calculate the hollow volume by it's shape compared to the prim shape | 212 | // calculate the hollow volume by it's shape compared to the prim shape |
214 | float hollowVolume = 0; | 213 | float hollowVolume = 0; |
215 | switch (_pbs.HollowShape) | 214 | switch (_pbs.HollowShape) |
@@ -217,29 +216,29 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
217 | case HollowShape.Square: | 216 | case HollowShape.Square: |
218 | case HollowShape.Same: | 217 | case HollowShape.Same: |
219 | // Cube Hollow volume calculation | 218 | // Cube Hollow volume calculation |
220 | float hollowsizex = _size.X * hollowAmount; | 219 | float hollowsizex = _size.X*hollowAmount; |
221 | float hollowsizey = _size.Y * hollowAmount; | 220 | float hollowsizey = _size.Y*hollowAmount; |
222 | float hollowsizez = _size.Z * hollowAmount; | 221 | float hollowsizez = _size.Z*hollowAmount; |
223 | hollowVolume = hollowsizex * hollowsizey * hollowsizez; | 222 | hollowVolume = hollowsizex*hollowsizey*hollowsizez; |
224 | break; | 223 | break; |
225 | 224 | ||
226 | case HollowShape.Circle: | 225 | case HollowShape.Circle: |
227 | // Hollow shape is a perfect cyllinder in respect to the cube's scale | 226 | // Hollow shape is a perfect cyllinder in respect to the cube's scale |
228 | // Cyllinder hollow volume calculation | 227 | // Cyllinder hollow volume calculation |
229 | float hRadius = _size.X / 2; | 228 | float hRadius = _size.X/2; |
230 | float hLength = _size.Z; | 229 | float hLength = _size.Z; |
231 | 230 | ||
232 | // pi * r2 * h | 231 | // pi * r2 * h |
233 | hollowVolume = ((float)(Math.PI * Math.Pow(hRadius, 2) * hLength) * hollowAmount); | 232 | hollowVolume = ((float) (Math.PI*Math.Pow(hRadius, 2)*hLength)*hollowAmount); |
234 | break; | 233 | break; |
235 | 234 | ||
236 | case HollowShape.Triangle: | 235 | case HollowShape.Triangle: |
237 | // Equilateral Triangular Prism volume hollow calculation | 236 | // Equilateral Triangular Prism volume hollow calculation |
238 | // Triangle is an Equilateral Triangular Prism with aLength = to _size.Y | 237 | // Triangle is an Equilateral Triangular Prism with aLength = to _size.Y |
239 | 238 | ||
240 | float aLength = _size.Y; | 239 | float aLength = _size.Y; |
241 | // 1/2 abh | 240 | // 1/2 abh |
242 | hollowVolume = (float)((0.5 * aLength * _size.X * _size.Z) * hollowAmount); | 241 | hollowVolume = (float) ((0.5*aLength*_size.X*_size.Z)*hollowAmount); |
243 | break; | 242 | break; |
244 | 243 | ||
245 | default: | 244 | default: |
@@ -247,15 +246,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
247 | break; | 246 | break; |
248 | } | 247 | } |
249 | volume = volume - hollowVolume; | 248 | volume = volume - hollowVolume; |
250 | |||
251 | } | 249 | } |
252 | 250 | ||
253 | break; | 251 | break; |
254 | 252 | ||
255 | default: | 253 | default: |
256 | // we don't have all of the volume formulas yet so | 254 | // we don't have all of the volume formulas yet so |
257 | // use the common volume formula for all | 255 | // use the common volume formula for all |
258 | volume = _size.X * _size.Y * _size.Z; | 256 | volume = _size.X*_size.Y*_size.Z; |
259 | break; | 257 | break; |
260 | } | 258 | } |
261 | 259 | ||
@@ -273,70 +271,70 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
273 | float PathCutStartAmount = _pbs.ProfileBegin; | 271 | float PathCutStartAmount = _pbs.ProfileBegin; |
274 | if (((PathCutStartAmount + PathCutEndAmount)/50000f) > 0.0f) | 272 | if (((PathCutStartAmount + PathCutEndAmount)/50000f) > 0.0f) |
275 | { | 273 | { |
274 | float pathCutAmount = ((PathCutStartAmount + PathCutEndAmount)/50000f); | ||
276 | 275 | ||
277 | float pathCutAmount = ((PathCutStartAmount + PathCutEndAmount) / 50000f); | ||
278 | |||
279 | // Check the return amount for sanity | 276 | // Check the return amount for sanity |
280 | if (pathCutAmount >= 0.99f) | 277 | if (pathCutAmount >= 0.99f) |
281 | pathCutAmount=0.99f; | 278 | pathCutAmount = 0.99f; |
282 | 279 | ||
283 | volume = volume - (volume * pathCutAmount); | 280 | volume = volume - (volume*pathCutAmount); |
284 | } | 281 | } |
285 | 282 | ||
286 | // Mass = density * volume | 283 | // Mass = density * volume |
287 | 284 | ||
288 | returnMass = m_density * volume; | 285 | returnMass = m_density*volume; |
289 | 286 | ||
290 | return returnMass; | 287 | return returnMass; |
291 | } | 288 | } |
292 | 289 | ||
293 | public void setMass() | 290 | public void setMass() |
294 | { | 291 | { |
295 | if (Body != (IntPtr)0) | 292 | if (Body != (IntPtr) 0) |
296 | { | 293 | { |
297 | d.MassSetBoxTotal(out pMass, CalculateMass(), _size.X, _size.Y, _size.Z); | 294 | d.MassSetBoxTotal(out pMass, CalculateMass(), _size.X, _size.Y, _size.Z); |
298 | d.BodySetMass(Body, ref pMass); | 295 | d.BodySetMass(Body, ref pMass); |
299 | } | 296 | } |
300 | } | 297 | } |
301 | 298 | ||
302 | |||
303 | 299 | ||
304 | public void disableBody() | 300 | public void disableBody() |
305 | { | 301 | { |
306 | //this kills the body so things like 'mesh' can re-create it. | 302 | //this kills the body so things like 'mesh' can re-create it. |
307 | if (Body != (IntPtr)0) | 303 | if (Body != (IntPtr) 0) |
308 | { | 304 | { |
309 | _parent_scene.remActivePrim(this); | 305 | _parent_scene.remActivePrim(this); |
310 | d.BodyDestroy(Body); | 306 | d.BodyDestroy(Body); |
311 | Body = (IntPtr)0; | 307 | Body = (IntPtr) 0; |
312 | } | 308 | } |
313 | } | 309 | } |
310 | |||
314 | public void setMesh(OdeScene parent_scene, IMesh mesh) | 311 | public void setMesh(OdeScene parent_scene, IMesh mesh) |
315 | { | 312 | { |
316 | //Kill Body so that mesh can re-make the geom | 313 | //Kill Body so that mesh can re-make the geom |
317 | if (IsPhysical && Body != (IntPtr)0) | 314 | if (IsPhysical && Body != (IntPtr) 0) |
318 | { | 315 | { |
319 | disableBody(); | 316 | disableBody(); |
320 | } | 317 | } |
321 | float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory | 318 | float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory |
322 | int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage | 319 | int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage |
323 | int VertexCount = vertexList.GetLength(0) / 3; | 320 | int VertexCount = vertexList.GetLength(0)/3; |
324 | int IndexCount = indexList.GetLength(0); | 321 | int IndexCount = indexList.GetLength(0); |
325 | 322 | ||
326 | _triMeshData = d.GeomTriMeshDataCreate(); | 323 | _triMeshData = d.GeomTriMeshDataCreate(); |
327 | 324 | ||
328 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertexList, 3 * sizeof(float), VertexCount, indexList, IndexCount, | 325 | d.GeomTriMeshDataBuildSimple(_triMeshData, vertexList, 3*sizeof (float), VertexCount, indexList, IndexCount, |
329 | 3 * sizeof(int)); | 326 | 3*sizeof (int)); |
330 | d.GeomTriMeshDataPreprocess(_triMeshData); | 327 | d.GeomTriMeshDataPreprocess(_triMeshData); |
331 | 328 | ||
332 | prim_geom = d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null); | 329 | prim_geom = d.CreateTriMesh(m_targetSpace, _triMeshData, parent_scene.triCallback, null, null); |
333 | 330 | ||
334 | if (IsPhysical && Body == (IntPtr)0) | 331 | if (IsPhysical && Body == (IntPtr) 0) |
335 | { | 332 | { |
336 | // Recreate the body | 333 | // Recreate the body |
337 | enableBody(); | 334 | enableBody(); |
338 | } | 335 | } |
339 | } | 336 | } |
337 | |||
340 | public void ProcessTaints(float timestep) | 338 | public void ProcessTaints(float timestep) |
341 | { | 339 | { |
342 | if (m_taintposition != _position) | 340 | if (m_taintposition != _position) |
@@ -357,14 +355,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
357 | if (m_taintshape) | 355 | if (m_taintshape) |
358 | changeshape(timestep); | 356 | changeshape(timestep); |
359 | // | 357 | // |
360 | |||
361 | } | 358 | } |
359 | |||
362 | public void Move(float timestep) | 360 | public void Move(float timestep) |
363 | { | 361 | { |
364 | if (m_isphysical) | 362 | if (m_isphysical) |
365 | { | 363 | { |
366 | // This is a fallback.. May no longer be necessary. | 364 | // This is a fallback.. May no longer be necessary. |
367 | if (Body == (IntPtr)0) | 365 | if (Body == (IntPtr) 0) |
368 | enableBody(); | 366 | enableBody(); |
369 | //Prim auto disable after 20 frames, | 367 | //Prim auto disable after 20 frames, |
370 | ///if you move it, re-enable the prim manually. | 368 | ///if you move it, re-enable the prim manually. |
@@ -382,35 +380,35 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
382 | 380 | ||
383 | m_taintposition = _position; | 381 | m_taintposition = _position; |
384 | } | 382 | } |
383 | |||
385 | public void rotate(float timestep) | 384 | public void rotate(float timestep) |
386 | { | 385 | { |
387 | |||
388 | d.Quaternion myrot = new d.Quaternion(); | 386 | d.Quaternion myrot = new d.Quaternion(); |
389 | myrot.W = _orientation.w; | 387 | myrot.W = _orientation.w; |
390 | myrot.X = _orientation.x; | 388 | myrot.X = _orientation.x; |
391 | myrot.Y = _orientation.y; | 389 | myrot.Y = _orientation.y; |
392 | myrot.Z = _orientation.z; | 390 | myrot.Z = _orientation.z; |
393 | d.GeomSetQuaternion(prim_geom, ref myrot); | 391 | d.GeomSetQuaternion(prim_geom, ref myrot); |
394 | if (m_isphysical && Body != (IntPtr)0) | 392 | if (m_isphysical && Body != (IntPtr) 0) |
395 | { | 393 | { |
396 | d.BodySetQuaternion(Body, ref myrot); | 394 | d.BodySetQuaternion(Body, ref myrot); |
397 | } | 395 | } |
398 | 396 | ||
399 | m_taintrot = _orientation; | 397 | m_taintrot = _orientation; |
400 | } | 398 | } |
399 | |||
401 | public void changePhysicsStatus(float timestap) | 400 | public void changePhysicsStatus(float timestap) |
402 | { | 401 | { |
403 | if (m_isphysical == true) | 402 | if (m_isphysical == true) |
404 | { | 403 | { |
405 | if (Body == (IntPtr)0) | 404 | if (Body == (IntPtr) 0) |
406 | { | 405 | { |
407 | enableBody(); | 406 | enableBody(); |
408 | } | 407 | } |
409 | |||
410 | } | 408 | } |
411 | else | 409 | else |
412 | { | 410 | { |
413 | if (Body != (IntPtr)0) | 411 | if (Body != (IntPtr) 0) |
414 | { | 412 | { |
415 | disableBody(); | 413 | disableBody(); |
416 | } | 414 | } |
@@ -419,6 +417,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
419 | 417 | ||
420 | m_taintPhysics = m_isphysical; | 418 | m_taintPhysics = m_isphysical; |
421 | } | 419 | } |
420 | |||
422 | public void changesize(float timestamp) | 421 | public void changesize(float timestamp) |
423 | { | 422 | { |
424 | string oldname = _parent_scene.geom_name_map[prim_geom]; | 423 | string oldname = _parent_scene.geom_name_map[prim_geom]; |
@@ -429,7 +428,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
429 | // Cleanup meshing here | 428 | // Cleanup meshing here |
430 | } | 429 | } |
431 | //kill body to rebuild | 430 | //kill body to rebuild |
432 | if (IsPhysical && Body != (IntPtr)0) | 431 | if (IsPhysical && Body != (IntPtr) 0) |
433 | { | 432 | { |
434 | disableBody(); | 433 | disableBody(); |
435 | } | 434 | } |
@@ -442,10 +441,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
442 | // we don't need to do space calculation because the client sends a position update also. | 441 | // we don't need to do space calculation because the client sends a position update also. |
443 | 442 | ||
444 | // Construction of new prim | 443 | // Construction of new prim |
445 | if (this._parent_scene.needsMeshing(_pbs)) | 444 | if (_parent_scene.needsMeshing(_pbs)) |
446 | { | 445 | { |
447 | |||
448 | |||
449 | // Don't need to re-enable body.. it's done in SetMesh | 446 | // Don't need to re-enable body.. it's done in SetMesh |
450 | IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size); | 447 | IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size); |
451 | // createmesh returns null when it's a shape that isn't a cube. | 448 | // createmesh returns null when it's a shape that isn't a cube. |
@@ -463,8 +460,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
463 | myrot.Y = _orientation.y; | 460 | myrot.Y = _orientation.y; |
464 | myrot.Z = _orientation.z; | 461 | myrot.Z = _orientation.z; |
465 | d.GeomSetQuaternion(prim_geom, ref myrot); | 462 | d.GeomSetQuaternion(prim_geom, ref myrot); |
466 | |||
467 | |||
468 | } | 463 | } |
469 | } | 464 | } |
470 | else | 465 | else |
@@ -480,7 +475,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
480 | 475 | ||
481 | 476 | ||
482 | //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); | 477 | //d.GeomBoxSetLengths(prim_geom, _size.X, _size.Y, _size.Z); |
483 | if (IsPhysical && Body == (IntPtr)0) | 478 | if (IsPhysical && Body == (IntPtr) 0) |
484 | { | 479 | { |
485 | // Re creates body on size. | 480 | // Re creates body on size. |
486 | // EnableBody also does setMass() | 481 | // EnableBody also does setMass() |
@@ -493,12 +488,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
493 | 488 | ||
494 | m_taintsize = _size; | 489 | m_taintsize = _size; |
495 | } | 490 | } |
491 | |||
496 | public void changeshape(float timestamp) | 492 | public void changeshape(float timestamp) |
497 | { | 493 | { |
498 | string oldname = _parent_scene.geom_name_map[prim_geom]; | 494 | string oldname = _parent_scene.geom_name_map[prim_geom]; |
499 | 495 | ||
500 | // Cleanup of old prim geometry and Bodies | 496 | // Cleanup of old prim geometry and Bodies |
501 | if (IsPhysical && Body != (IntPtr)0) | 497 | if (IsPhysical && Body != (IntPtr) 0) |
502 | { | 498 | { |
503 | disableBody(); | 499 | disableBody(); |
504 | } | 500 | } |
@@ -509,7 +505,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
509 | } | 505 | } |
510 | 506 | ||
511 | // Construction of new prim | 507 | // Construction of new prim |
512 | if (this._parent_scene.needsMeshing(_pbs)) | 508 | if (_parent_scene.needsMeshing(_pbs)) |
513 | { | 509 | { |
514 | IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size); | 510 | IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size); |
515 | if (mesh != null) | 511 | if (mesh != null) |
@@ -525,7 +521,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
525 | { | 521 | { |
526 | prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); | 522 | prim_geom = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); |
527 | } | 523 | } |
528 | if (IsPhysical && Body == (IntPtr)0) | 524 | if (IsPhysical && Body == (IntPtr) 0) |
529 | { | 525 | { |
530 | //re-create new body | 526 | //re-create new body |
531 | enableBody(); | 527 | enableBody(); |
@@ -544,11 +540,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
544 | 540 | ||
545 | m_taintshape = false; | 541 | m_taintshape = false; |
546 | } | 542 | } |
543 | |||
547 | public override bool IsPhysical | 544 | public override bool IsPhysical |
548 | { | 545 | { |
549 | get { return m_isphysical; } | 546 | get { return m_isphysical; } |
550 | set { m_isphysical = value; } | 547 | set { m_isphysical = value; } |
551 | } | 548 | } |
549 | |||
552 | public void setPrimForRemoval() | 550 | public void setPrimForRemoval() |
553 | { | 551 | { |
554 | m_taintremove = true; | 552 | m_taintremove = true; |
@@ -556,9 +554,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
556 | 554 | ||
557 | public override bool Flying | 555 | public override bool Flying |
558 | { | 556 | { |
559 | get | 557 | get { return false; //no flying prims for you |
560 | { | ||
561 | return false; //no flying prims for you | ||
562 | } | 558 | } |
563 | set { } | 559 | set { } |
564 | } | 560 | } |
@@ -568,16 +564,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
568 | get { return iscolliding; } | 564 | get { return iscolliding; } |
569 | set { iscolliding = value; } | 565 | set { iscolliding = value; } |
570 | } | 566 | } |
567 | |||
571 | public override bool CollidingGround | 568 | public override bool CollidingGround |
572 | { | 569 | { |
573 | get { return false; } | 570 | get { return false; } |
574 | set { return; } | 571 | set { return; } |
575 | } | 572 | } |
573 | |||
576 | public override bool CollidingObj | 574 | public override bool CollidingObj |
577 | { | 575 | { |
578 | get { return false; } | 576 | get { return false; } |
579 | set { return; } | 577 | set { return; } |
580 | } | 578 | } |
579 | |||
581 | public override bool ThrottleUpdates | 580 | public override bool ThrottleUpdates |
582 | { | 581 | { |
583 | get { return m_throttleUpdates; } | 582 | get { return m_throttleUpdates; } |
@@ -588,20 +587,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
588 | { | 587 | { |
589 | get { return _position; } | 588 | get { return _position; } |
590 | 589 | ||
591 | set | 590 | set { _position = value; } |
592 | { | ||
593 | _position = value; | ||
594 | |||
595 | } | ||
596 | } | 591 | } |
597 | 592 | ||
598 | public override PhysicsVector Size | 593 | public override PhysicsVector Size |
599 | { | 594 | { |
600 | get { return _size; } | 595 | get { return _size; } |
601 | set | 596 | set { _size = value; } |
602 | { | ||
603 | _size = value; | ||
604 | } | ||
605 | } | 597 | } |
606 | 598 | ||
607 | public override float Mass | 599 | public override float Mass |
@@ -626,10 +618,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
626 | 618 | ||
627 | public override PrimitiveBaseShape Shape | 619 | public override PrimitiveBaseShape Shape |
628 | { | 620 | { |
629 | set | 621 | set { _pbs = value; } |
630 | { | ||
631 | _pbs = value; | ||
632 | } | ||
633 | } | 622 | } |
634 | 623 | ||
635 | public override PhysicsVector Velocity | 624 | public override PhysicsVector Velocity |
@@ -639,9 +628,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
639 | // Averate previous velocity with the new one so | 628 | // Averate previous velocity with the new one so |
640 | // client object interpolation works a 'little' better | 629 | // client object interpolation works a 'little' better |
641 | PhysicsVector returnVelocity = new PhysicsVector(); | 630 | PhysicsVector returnVelocity = new PhysicsVector(); |
642 | returnVelocity.X = (m_lastVelocity.X + _velocity.X) / 2; | 631 | returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; |
643 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) / 2; | 632 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2; |
644 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) / 2; | 633 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; |
645 | return returnVelocity; | 634 | return returnVelocity; |
646 | } | 635 | } |
647 | set { _velocity = value; } | 636 | set { _velocity = value; } |
@@ -656,11 +645,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
656 | public override Quaternion Orientation | 645 | public override Quaternion Orientation |
657 | { | 646 | { |
658 | get { return _orientation; } | 647 | get { return _orientation; } |
659 | set | 648 | set { _orientation = value; } |
660 | { | ||
661 | _orientation = value; | ||
662 | |||
663 | } | ||
664 | } | 649 | } |
665 | 650 | ||
666 | public override PhysicsVector Acceleration | 651 | public override PhysicsVector Acceleration |
@@ -688,7 +673,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
688 | { | 673 | { |
689 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 674 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
690 | 675 | ||
691 | if (Body != (IntPtr)0) | 676 | if (Body != (IntPtr) 0) |
692 | { | 677 | { |
693 | d.Vector3 vec = d.BodyGetPosition(Body); | 678 | d.Vector3 vec = d.BodyGetPosition(Body); |
694 | d.Quaternion ori = d.BodyGetQuaternion(Body); | 679 | d.Quaternion ori = d.BodyGetQuaternion(Body); |
@@ -715,8 +700,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
715 | // It's a hack and will generate a console message if it fails. | 700 | // It's a hack and will generate a console message if it fails. |
716 | 701 | ||
717 | 702 | ||
718 | |||
719 | |||
720 | //IsPhysical = false; | 703 | //IsPhysical = false; |
721 | base.RaiseOutOfBounds(_position); | 704 | base.RaiseOutOfBounds(_position); |
722 | _velocity.X = 0; | 705 | _velocity.X = 0; |
@@ -736,7 +719,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
736 | && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02) | 719 | && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02) |
737 | && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02)) | 720 | && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02)) |
738 | { | 721 | { |
739 | |||
740 | _zeroFlag = true; | 722 | _zeroFlag = true; |
741 | } | 723 | } |
742 | else | 724 | else |
@@ -746,7 +728,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
746 | } | 728 | } |
747 | 729 | ||
748 | 730 | ||
749 | |||
750 | if (_zeroFlag) | 731 | if (_zeroFlag) |
751 | { | 732 | { |
752 | // Supposedly this is supposed to tell SceneObjectGroup that | 733 | // Supposedly this is supposed to tell SceneObjectGroup that |
@@ -811,10 +792,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
811 | m_rotationalVelocity.Z = 0; | 792 | m_rotationalVelocity.Z = 0; |
812 | _zeroFlag = true; | 793 | _zeroFlag = true; |
813 | } | 794 | } |
814 | |||
815 | } | 795 | } |
796 | |||
816 | public override void SetMomentum(PhysicsVector momentum) | 797 | public override void SetMomentum(PhysicsVector momentum) |
817 | { | 798 | { |
818 | } | 799 | } |
819 | } | 800 | } |
820 | } | 801 | } \ No newline at end of file |