diff options
author | Robert Adams | 2013-04-28 21:50:47 -0700 |
---|---|---|
committer | Robert Adams | 2013-04-29 07:38:55 -0700 |
commit | ad1787770ed02f71feaa002ab689467e187803bb (patch) | |
tree | 08026c7b0b160ae9b16c2876894852f8a729bbb4 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |
parent | BulletSim: first cut at new linksetCompound shape building. (diff) | |
download | opensim-SC-ad1787770ed02f71feaa002ab689467e187803bb.zip opensim-SC-ad1787770ed02f71feaa002ab689467e187803bb.tar.gz opensim-SC-ad1787770ed02f71feaa002ab689467e187803bb.tar.bz2 opensim-SC-ad1787770ed02f71feaa002ab689467e187803bb.tar.xz |
BulletSim: rename variable 'PhysicsScene' to be either 'PhysScene' or 'm_physicsScene' to match coding conventions and reduce confusion.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 5d12338..0d45579 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -101,21 +101,21 @@ public class BSPrim : BSPhysObject | |||
101 | _isVolumeDetect = false; | 101 | _isVolumeDetect = false; |
102 | 102 | ||
103 | // We keep a handle to the vehicle actor so we can set vehicle parameters later. | 103 | // We keep a handle to the vehicle actor so we can set vehicle parameters later. |
104 | VehicleActor = new BSDynamics(PhysicsScene, this, VehicleActorName); | 104 | VehicleActor = new BSDynamics(PhysScene, this, VehicleActorName); |
105 | PhysicalActors.Add(VehicleActorName, VehicleActor); | 105 | PhysicalActors.Add(VehicleActorName, VehicleActor); |
106 | 106 | ||
107 | _mass = CalculateMass(); | 107 | _mass = CalculateMass(); |
108 | 108 | ||
109 | // DetailLog("{0},BSPrim.constructor,call", LocalID); | 109 | // DetailLog("{0},BSPrim.constructor,call", LocalID); |
110 | // do the actual object creation at taint time | 110 | // do the actual object creation at taint time |
111 | PhysicsScene.TaintedObject("BSPrim.create", delegate() | 111 | PhysScene.TaintedObject("BSPrim.create", delegate() |
112 | { | 112 | { |
113 | // Make sure the object is being created with some sanity. | 113 | // Make sure the object is being created with some sanity. |
114 | ExtremeSanityCheck(true /* inTaintTime */); | 114 | ExtremeSanityCheck(true /* inTaintTime */); |
115 | 115 | ||
116 | CreateGeomAndObject(true); | 116 | CreateGeomAndObject(true); |
117 | 117 | ||
118 | CurrentCollisionFlags = PhysicsScene.PE.GetCollisionFlags(PhysBody); | 118 | CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody); |
119 | }); | 119 | }); |
120 | } | 120 | } |
121 | 121 | ||
@@ -128,13 +128,13 @@ public class BSPrim : BSPhysObject | |||
128 | // Undo any vehicle properties | 128 | // Undo any vehicle properties |
129 | this.VehicleType = (int)Vehicle.TYPE_NONE; | 129 | this.VehicleType = (int)Vehicle.TYPE_NONE; |
130 | 130 | ||
131 | PhysicsScene.TaintedObject("BSPrim.Destroy", delegate() | 131 | PhysScene.TaintedObject("BSPrim.Destroy", delegate() |
132 | { | 132 | { |
133 | DetailLog("{0},BSPrim.Destroy,taint,", LocalID); | 133 | DetailLog("{0},BSPrim.Destroy,taint,", LocalID); |
134 | // If there are physical body and shape, release my use of same. | 134 | // If there are physical body and shape, release my use of same. |
135 | PhysicsScene.Shapes.DereferenceBody(PhysBody, null); | 135 | PhysScene.Shapes.DereferenceBody(PhysBody, null); |
136 | PhysBody.Clear(); | 136 | PhysBody.Clear(); |
137 | PhysShape.Dereference(PhysicsScene); | 137 | PhysShape.Dereference(PhysScene); |
138 | PhysShape = new BSShapeNull(); | 138 | PhysShape = new BSShapeNull(); |
139 | }); | 139 | }); |
140 | } | 140 | } |
@@ -163,7 +163,7 @@ public class BSPrim : BSPhysObject | |||
163 | } | 163 | } |
164 | public override bool ForceBodyShapeRebuild(bool inTaintTime) | 164 | public override bool ForceBodyShapeRebuild(bool inTaintTime) |
165 | { | 165 | { |
166 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ForceBodyShapeRebuild", delegate() | 166 | PhysScene.TaintedObject(inTaintTime, "BSPrim.ForceBodyShapeRebuild", delegate() |
167 | { | 167 | { |
168 | _mass = CalculateMass(); // changing the shape changes the mass | 168 | _mass = CalculateMass(); // changing the shape changes the mass |
169 | CreateGeomAndObject(true); | 169 | CreateGeomAndObject(true); |
@@ -180,7 +180,7 @@ public class BSPrim : BSPhysObject | |||
180 | if (value != _isSelected) | 180 | if (value != _isSelected) |
181 | { | 181 | { |
182 | _isSelected = value; | 182 | _isSelected = value; |
183 | PhysicsScene.TaintedObject("BSPrim.setSelected", delegate() | 183 | PhysScene.TaintedObject("BSPrim.setSelected", delegate() |
184 | { | 184 | { |
185 | DetailLog("{0},BSPrim.selected,taint,selected={1}", LocalID, _isSelected); | 185 | DetailLog("{0},BSPrim.selected,taint,selected={1}", LocalID, _isSelected); |
186 | SetObjectDynamic(false); | 186 | SetObjectDynamic(false); |
@@ -226,23 +226,23 @@ public class BSPrim : BSPhysObject | |||
226 | _rotationalVelocity = OMV.Vector3.Zero; | 226 | _rotationalVelocity = OMV.Vector3.Zero; |
227 | 227 | ||
228 | // Zero some other properties in the physics engine | 228 | // Zero some other properties in the physics engine |
229 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() | 229 | PhysScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() |
230 | { | 230 | { |
231 | if (PhysBody.HasPhysicalBody) | 231 | if (PhysBody.HasPhysicalBody) |
232 | PhysicsScene.PE.ClearAllForces(PhysBody); | 232 | PhysScene.PE.ClearAllForces(PhysBody); |
233 | }); | 233 | }); |
234 | } | 234 | } |
235 | public override void ZeroAngularMotion(bool inTaintTime) | 235 | public override void ZeroAngularMotion(bool inTaintTime) |
236 | { | 236 | { |
237 | _rotationalVelocity = OMV.Vector3.Zero; | 237 | _rotationalVelocity = OMV.Vector3.Zero; |
238 | // Zero some other properties in the physics engine | 238 | // Zero some other properties in the physics engine |
239 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() | 239 | PhysScene.TaintedObject(inTaintTime, "BSPrim.ZeroMotion", delegate() |
240 | { | 240 | { |
241 | // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity); | 241 | // DetailLog("{0},BSPrim.ZeroAngularMotion,call,rotVel={1}", LocalID, _rotationalVelocity); |
242 | if (PhysBody.HasPhysicalBody) | 242 | if (PhysBody.HasPhysicalBody) |
243 | { | 243 | { |
244 | PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); | 244 | PhysScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); |
245 | PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); | 245 | PhysScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); |
246 | } | 246 | } |
247 | }); | 247 | }); |
248 | } | 248 | } |
@@ -260,11 +260,11 @@ public class BSPrim : BSPhysObject | |||
260 | 260 | ||
261 | EnableActor(LockedAxis != LockedAxisFree, LockedAxisActorName, delegate() | 261 | EnableActor(LockedAxis != LockedAxisFree, LockedAxisActorName, delegate() |
262 | { | 262 | { |
263 | return new BSActorLockAxis(PhysicsScene, this, LockedAxisActorName); | 263 | return new BSActorLockAxis(PhysScene, this, LockedAxisActorName); |
264 | }); | 264 | }); |
265 | 265 | ||
266 | // Update parameters so the new actor's Refresh() action is called at the right time. | 266 | // Update parameters so the new actor's Refresh() action is called at the right time. |
267 | PhysicsScene.TaintedObject("BSPrim.LockAngularMotion", delegate() | 267 | PhysScene.TaintedObject("BSPrim.LockAngularMotion", delegate() |
268 | { | 268 | { |
269 | UpdatePhysicalParameters(); | 269 | UpdatePhysicalParameters(); |
270 | }); | 270 | }); |
@@ -294,7 +294,7 @@ public class BSPrim : BSPhysObject | |||
294 | _position = value; | 294 | _position = value; |
295 | PositionSanityCheck(false); | 295 | PositionSanityCheck(false); |
296 | 296 | ||
297 | PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() | 297 | PhysScene.TaintedObject("BSPrim.setPosition", delegate() |
298 | { | 298 | { |
299 | DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 299 | DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
300 | ForcePosition = _position; | 300 | ForcePosition = _position; |
@@ -304,14 +304,14 @@ public class BSPrim : BSPhysObject | |||
304 | 304 | ||
305 | public override OMV.Vector3 ForcePosition { | 305 | public override OMV.Vector3 ForcePosition { |
306 | get { | 306 | get { |
307 | _position = PhysicsScene.PE.GetPosition(PhysBody); | 307 | _position = PhysScene.PE.GetPosition(PhysBody); |
308 | return _position; | 308 | return _position; |
309 | } | 309 | } |
310 | set { | 310 | set { |
311 | _position = value; | 311 | _position = value; |
312 | if (PhysBody.HasPhysicalBody) | 312 | if (PhysBody.HasPhysicalBody) |
313 | { | 313 | { |
314 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); | 314 | PhysScene.PE.SetTranslation(PhysBody, _position, _orientation); |
315 | ActivateIfPhysical(false); | 315 | ActivateIfPhysical(false); |
316 | } | 316 | } |
317 | } | 317 | } |
@@ -328,7 +328,7 @@ public class BSPrim : BSPhysObject | |||
328 | if (!IsPhysicallyActive) | 328 | if (!IsPhysicallyActive) |
329 | return ret; | 329 | return ret; |
330 | 330 | ||
331 | if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(RawPosition)) | 331 | if (!PhysScene.TerrainManager.IsWithinKnownTerrain(RawPosition)) |
332 | { | 332 | { |
333 | // The physical object is out of the known/simulated area. | 333 | // The physical object is out of the known/simulated area. |
334 | // Upper levels of code will handle the transition to other areas so, for | 334 | // Upper levels of code will handle the transition to other areas so, for |
@@ -336,7 +336,7 @@ public class BSPrim : BSPhysObject | |||
336 | return ret; | 336 | return ret; |
337 | } | 337 | } |
338 | 338 | ||
339 | float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition); | 339 | float terrainHeight = PhysScene.TerrainManager.GetTerrainHeightAtXYZ(RawPosition); |
340 | OMV.Vector3 upForce = OMV.Vector3.Zero; | 340 | OMV.Vector3 upForce = OMV.Vector3.Zero; |
341 | float approxSize = Math.Max(Size.X, Math.Max(Size.Y, Size.Z)); | 341 | float approxSize = Math.Max(Size.X, Math.Max(Size.Y, Size.Z)); |
342 | if ((RawPosition.Z + approxSize / 2f) < terrainHeight) | 342 | if ((RawPosition.Z + approxSize / 2f) < terrainHeight) |
@@ -357,7 +357,7 @@ public class BSPrim : BSPhysObject | |||
357 | 357 | ||
358 | if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0) | 358 | if ((CurrentCollisionFlags & CollisionFlags.BS_FLOATS_ON_WATER) != 0) |
359 | { | 359 | { |
360 | float waterHeight = PhysicsScene.TerrainManager.GetWaterLevelAtXYZ(_position); | 360 | float waterHeight = PhysScene.TerrainManager.GetWaterLevelAtXYZ(_position); |
361 | // TODO: a floating motor so object will bob in the water | 361 | // TODO: a floating motor so object will bob in the water |
362 | if (Math.Abs(RawPosition.Z - waterHeight) > 0.1f) | 362 | if (Math.Abs(RawPosition.Z - waterHeight) > 0.1f) |
363 | { | 363 | { |
@@ -365,7 +365,7 @@ public class BSPrim : BSPhysObject | |||
365 | upForce.Z = (waterHeight - RawPosition.Z) * 1f; | 365 | upForce.Z = (waterHeight - RawPosition.Z) * 1f; |
366 | 366 | ||
367 | // Apply upforce and overcome gravity. | 367 | // Apply upforce and overcome gravity. |
368 | OMV.Vector3 correctionForce = upForce - PhysicsScene.DefaultGravity; | 368 | OMV.Vector3 correctionForce = upForce - PhysScene.DefaultGravity; |
369 | DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, _position, upForce, correctionForce); | 369 | DetailLog("{0},BSPrim.PositionSanityCheck,applyForce,pos={1},upForce={2},correctionForce={3}", LocalID, _position, upForce, correctionForce); |
370 | AddForce(correctionForce, false, inTaintTime); | 370 | AddForce(correctionForce, false, inTaintTime); |
371 | ret = true; | 371 | ret = true; |
@@ -431,10 +431,10 @@ public class BSPrim : BSPhysObject | |||
431 | { | 431 | { |
432 | if (IsStatic) | 432 | if (IsStatic) |
433 | { | 433 | { |
434 | PhysicsScene.PE.SetGravity(PhysBody, PhysicsScene.DefaultGravity); | 434 | PhysScene.PE.SetGravity(PhysBody, PhysScene.DefaultGravity); |
435 | Inertia = OMV.Vector3.Zero; | 435 | Inertia = OMV.Vector3.Zero; |
436 | PhysicsScene.PE.SetMassProps(PhysBody, 0f, Inertia); | 436 | PhysScene.PE.SetMassProps(PhysBody, 0f, Inertia); |
437 | PhysicsScene.PE.UpdateInertiaTensor(PhysBody); | 437 | PhysScene.PE.UpdateInertiaTensor(PhysBody); |
438 | } | 438 | } |
439 | else | 439 | else |
440 | { | 440 | { |
@@ -443,16 +443,16 @@ public class BSPrim : BSPhysObject | |||
443 | // Changing interesting properties doesn't change proxy and collision cache | 443 | // Changing interesting properties doesn't change proxy and collision cache |
444 | // information. The Bullet solution is to re-add the object to the world | 444 | // information. The Bullet solution is to re-add the object to the world |
445 | // after parameters are changed. | 445 | // after parameters are changed. |
446 | PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody); | 446 | PhysScene.PE.RemoveObjectFromWorld(PhysScene.World, PhysBody); |
447 | } | 447 | } |
448 | 448 | ||
449 | // The computation of mass props requires gravity to be set on the object. | 449 | // The computation of mass props requires gravity to be set on the object. |
450 | Gravity = ComputeGravity(Buoyancy); | 450 | Gravity = ComputeGravity(Buoyancy); |
451 | PhysicsScene.PE.SetGravity(PhysBody, Gravity); | 451 | PhysScene.PE.SetGravity(PhysBody, Gravity); |
452 | 452 | ||
453 | Inertia = PhysicsScene.PE.CalculateLocalInertia(PhysShape.physShapeInfo, physMass); | 453 | Inertia = PhysScene.PE.CalculateLocalInertia(PhysShape.physShapeInfo, physMass); |
454 | PhysicsScene.PE.SetMassProps(PhysBody, physMass, Inertia); | 454 | PhysScene.PE.SetMassProps(PhysBody, physMass, Inertia); |
455 | PhysicsScene.PE.UpdateInertiaTensor(PhysBody); | 455 | PhysScene.PE.UpdateInertiaTensor(PhysBody); |
456 | 456 | ||
457 | DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2},grav={3},inWorld={4}", | 457 | DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2},grav={3},inWorld={4}", |
458 | LocalID, physMass, Inertia, Gravity, inWorld); | 458 | LocalID, physMass, Inertia, Gravity, inWorld); |
@@ -468,7 +468,7 @@ public class BSPrim : BSPhysObject | |||
468 | // Return what gravity should be set to this very moment | 468 | // Return what gravity should be set to this very moment |
469 | public OMV.Vector3 ComputeGravity(float buoyancy) | 469 | public OMV.Vector3 ComputeGravity(float buoyancy) |
470 | { | 470 | { |
471 | OMV.Vector3 ret = PhysicsScene.DefaultGravity; | 471 | OMV.Vector3 ret = PhysScene.DefaultGravity; |
472 | 472 | ||
473 | if (!IsStatic) | 473 | if (!IsStatic) |
474 | { | 474 | { |
@@ -497,7 +497,7 @@ public class BSPrim : BSPhysObject | |||
497 | RawForce = value; | 497 | RawForce = value; |
498 | EnableActor(RawForce != OMV.Vector3.Zero, SetForceActorName, delegate() | 498 | EnableActor(RawForce != OMV.Vector3.Zero, SetForceActorName, delegate() |
499 | { | 499 | { |
500 | return new BSActorSetForce(PhysicsScene, this, SetForceActorName); | 500 | return new BSActorSetForce(PhysScene, this, SetForceActorName); |
501 | }); | 501 | }); |
502 | } | 502 | } |
503 | } | 503 | } |
@@ -509,7 +509,7 @@ public class BSPrim : BSPhysObject | |||
509 | set { | 509 | set { |
510 | Vehicle type = (Vehicle)value; | 510 | Vehicle type = (Vehicle)value; |
511 | 511 | ||
512 | PhysicsScene.TaintedObject("setVehicleType", delegate() | 512 | PhysScene.TaintedObject("setVehicleType", delegate() |
513 | { | 513 | { |
514 | // Vehicle code changes the parameters for this vehicle type. | 514 | // Vehicle code changes the parameters for this vehicle type. |
515 | VehicleActor.ProcessTypeChange(type); | 515 | VehicleActor.ProcessTypeChange(type); |
@@ -519,7 +519,7 @@ public class BSPrim : BSPhysObject | |||
519 | } | 519 | } |
520 | public override void VehicleFloatParam(int param, float value) | 520 | public override void VehicleFloatParam(int param, float value) |
521 | { | 521 | { |
522 | PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() | 522 | PhysScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() |
523 | { | 523 | { |
524 | VehicleActor.ProcessFloatVehicleParam((Vehicle)param, value); | 524 | VehicleActor.ProcessFloatVehicleParam((Vehicle)param, value); |
525 | ActivateIfPhysical(false); | 525 | ActivateIfPhysical(false); |
@@ -527,7 +527,7 @@ public class BSPrim : BSPhysObject | |||
527 | } | 527 | } |
528 | public override void VehicleVectorParam(int param, OMV.Vector3 value) | 528 | public override void VehicleVectorParam(int param, OMV.Vector3 value) |
529 | { | 529 | { |
530 | PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() | 530 | PhysScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() |
531 | { | 531 | { |
532 | VehicleActor.ProcessVectorVehicleParam((Vehicle)param, value); | 532 | VehicleActor.ProcessVectorVehicleParam((Vehicle)param, value); |
533 | ActivateIfPhysical(false); | 533 | ActivateIfPhysical(false); |
@@ -535,7 +535,7 @@ public class BSPrim : BSPhysObject | |||
535 | } | 535 | } |
536 | public override void VehicleRotationParam(int param, OMV.Quaternion rotation) | 536 | public override void VehicleRotationParam(int param, OMV.Quaternion rotation) |
537 | { | 537 | { |
538 | PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() | 538 | PhysScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() |
539 | { | 539 | { |
540 | VehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation); | 540 | VehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation); |
541 | ActivateIfPhysical(false); | 541 | ActivateIfPhysical(false); |
@@ -543,7 +543,7 @@ public class BSPrim : BSPhysObject | |||
543 | } | 543 | } |
544 | public override void VehicleFlags(int param, bool remove) | 544 | public override void VehicleFlags(int param, bool remove) |
545 | { | 545 | { |
546 | PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate() | 546 | PhysScene.TaintedObject("BSPrim.VehicleFlags", delegate() |
547 | { | 547 | { |
548 | VehicleActor.ProcessVehicleFlags(param, remove); | 548 | VehicleActor.ProcessVehicleFlags(param, remove); |
549 | }); | 549 | }); |
@@ -555,7 +555,7 @@ public class BSPrim : BSPhysObject | |||
555 | if (_isVolumeDetect != newValue) | 555 | if (_isVolumeDetect != newValue) |
556 | { | 556 | { |
557 | _isVolumeDetect = newValue; | 557 | _isVolumeDetect = newValue; |
558 | PhysicsScene.TaintedObject("BSPrim.SetVolumeDetect", delegate() | 558 | PhysScene.TaintedObject("BSPrim.SetVolumeDetect", delegate() |
559 | { | 559 | { |
560 | // DetailLog("{0},setVolumeDetect,taint,volDetect={1}", LocalID, _isVolumeDetect); | 560 | // DetailLog("{0},setVolumeDetect,taint,volDetect={1}", LocalID, _isVolumeDetect); |
561 | SetObjectDynamic(true); | 561 | SetObjectDynamic(true); |
@@ -566,7 +566,7 @@ public class BSPrim : BSPhysObject | |||
566 | public override void SetMaterial(int material) | 566 | public override void SetMaterial(int material) |
567 | { | 567 | { |
568 | base.SetMaterial(material); | 568 | base.SetMaterial(material); |
569 | PhysicsScene.TaintedObject("BSPrim.SetMaterial", delegate() | 569 | PhysScene.TaintedObject("BSPrim.SetMaterial", delegate() |
570 | { | 570 | { |
571 | UpdatePhysicalParameters(); | 571 | UpdatePhysicalParameters(); |
572 | }); | 572 | }); |
@@ -579,7 +579,7 @@ public class BSPrim : BSPhysObject | |||
579 | if (base.Friction != value) | 579 | if (base.Friction != value) |
580 | { | 580 | { |
581 | base.Friction = value; | 581 | base.Friction = value; |
582 | PhysicsScene.TaintedObject("BSPrim.setFriction", delegate() | 582 | PhysScene.TaintedObject("BSPrim.setFriction", delegate() |
583 | { | 583 | { |
584 | UpdatePhysicalParameters(); | 584 | UpdatePhysicalParameters(); |
585 | }); | 585 | }); |
@@ -594,7 +594,7 @@ public class BSPrim : BSPhysObject | |||
594 | if (base.Restitution != value) | 594 | if (base.Restitution != value) |
595 | { | 595 | { |
596 | base.Restitution = value; | 596 | base.Restitution = value; |
597 | PhysicsScene.TaintedObject("BSPrim.setRestitution", delegate() | 597 | PhysScene.TaintedObject("BSPrim.setRestitution", delegate() |
598 | { | 598 | { |
599 | UpdatePhysicalParameters(); | 599 | UpdatePhysicalParameters(); |
600 | }); | 600 | }); |
@@ -611,7 +611,7 @@ public class BSPrim : BSPhysObject | |||
611 | if (base.Density != value) | 611 | if (base.Density != value) |
612 | { | 612 | { |
613 | base.Density = value; | 613 | base.Density = value; |
614 | PhysicsScene.TaintedObject("BSPrim.setDensity", delegate() | 614 | PhysScene.TaintedObject("BSPrim.setDensity", delegate() |
615 | { | 615 | { |
616 | UpdatePhysicalParameters(); | 616 | UpdatePhysicalParameters(); |
617 | }); | 617 | }); |
@@ -626,7 +626,7 @@ public class BSPrim : BSPhysObject | |||
626 | if (base.GravModifier != value) | 626 | if (base.GravModifier != value) |
627 | { | 627 | { |
628 | base.GravModifier = value; | 628 | base.GravModifier = value; |
629 | PhysicsScene.TaintedObject("BSPrim.setGravityModifier", delegate() | 629 | PhysScene.TaintedObject("BSPrim.setGravityModifier", delegate() |
630 | { | 630 | { |
631 | UpdatePhysicalParameters(); | 631 | UpdatePhysicalParameters(); |
632 | }); | 632 | }); |
@@ -637,7 +637,7 @@ public class BSPrim : BSPhysObject | |||
637 | get { return RawVelocity; } | 637 | get { return RawVelocity; } |
638 | set { | 638 | set { |
639 | RawVelocity = value; | 639 | RawVelocity = value; |
640 | PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate() | 640 | PhysScene.TaintedObject("BSPrim.setVelocity", delegate() |
641 | { | 641 | { |
642 | // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, RawVelocity); | 642 | // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, RawVelocity); |
643 | ForceVelocity = RawVelocity; | 643 | ForceVelocity = RawVelocity; |
@@ -647,13 +647,13 @@ public class BSPrim : BSPhysObject | |||
647 | public override OMV.Vector3 ForceVelocity { | 647 | public override OMV.Vector3 ForceVelocity { |
648 | get { return RawVelocity; } | 648 | get { return RawVelocity; } |
649 | set { | 649 | set { |
650 | PhysicsScene.AssertInTaintTime("BSPrim.ForceVelocity"); | 650 | PhysScene.AssertInTaintTime("BSPrim.ForceVelocity"); |
651 | 651 | ||
652 | RawVelocity = Util.ClampV(value, BSParam.MaxLinearVelocity); | 652 | RawVelocity = Util.ClampV(value, BSParam.MaxLinearVelocity); |
653 | if (PhysBody.HasPhysicalBody) | 653 | if (PhysBody.HasPhysicalBody) |
654 | { | 654 | { |
655 | DetailLog("{0},BSPrim.ForceVelocity,taint,vel={1}", LocalID, RawVelocity); | 655 | DetailLog("{0},BSPrim.ForceVelocity,taint,vel={1}", LocalID, RawVelocity); |
656 | PhysicsScene.PE.SetLinearVelocity(PhysBody, RawVelocity); | 656 | PhysScene.PE.SetLinearVelocity(PhysBody, RawVelocity); |
657 | ActivateIfPhysical(false); | 657 | ActivateIfPhysical(false); |
658 | } | 658 | } |
659 | } | 659 | } |
@@ -664,7 +664,7 @@ public class BSPrim : BSPhysObject | |||
664 | RawTorque = value; | 664 | RawTorque = value; |
665 | EnableActor(RawTorque != OMV.Vector3.Zero, SetTorqueActorName, delegate() | 665 | EnableActor(RawTorque != OMV.Vector3.Zero, SetTorqueActorName, delegate() |
666 | { | 666 | { |
667 | return new BSActorSetTorque(PhysicsScene, this, SetTorqueActorName); | 667 | return new BSActorSetTorque(PhysScene, this, SetTorqueActorName); |
668 | }); | 668 | }); |
669 | DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, RawTorque); | 669 | DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, RawTorque); |
670 | } | 670 | } |
@@ -687,7 +687,7 @@ public class BSPrim : BSPhysObject | |||
687 | return; | 687 | return; |
688 | _orientation = value; | 688 | _orientation = value; |
689 | 689 | ||
690 | PhysicsScene.TaintedObject("BSPrim.setOrientation", delegate() | 690 | PhysScene.TaintedObject("BSPrim.setOrientation", delegate() |
691 | { | 691 | { |
692 | ForceOrientation = _orientation; | 692 | ForceOrientation = _orientation; |
693 | }); | 693 | }); |
@@ -698,14 +698,14 @@ public class BSPrim : BSPhysObject | |||
698 | { | 698 | { |
699 | get | 699 | get |
700 | { | 700 | { |
701 | _orientation = PhysicsScene.PE.GetOrientation(PhysBody); | 701 | _orientation = PhysScene.PE.GetOrientation(PhysBody); |
702 | return _orientation; | 702 | return _orientation; |
703 | } | 703 | } |
704 | set | 704 | set |
705 | { | 705 | { |
706 | _orientation = value; | 706 | _orientation = value; |
707 | if (PhysBody.HasPhysicalBody) | 707 | if (PhysBody.HasPhysicalBody) |
708 | PhysicsScene.PE.SetTranslation(PhysBody, _position, _orientation); | 708 | PhysScene.PE.SetTranslation(PhysBody, _position, _orientation); |
709 | } | 709 | } |
710 | } | 710 | } |
711 | public override int PhysicsActorType { | 711 | public override int PhysicsActorType { |
@@ -718,7 +718,7 @@ public class BSPrim : BSPhysObject | |||
718 | if (_isPhysical != value) | 718 | if (_isPhysical != value) |
719 | { | 719 | { |
720 | _isPhysical = value; | 720 | _isPhysical = value; |
721 | PhysicsScene.TaintedObject("BSPrim.setIsPhysical", delegate() | 721 | PhysScene.TaintedObject("BSPrim.setIsPhysical", delegate() |
722 | { | 722 | { |
723 | DetailLog("{0},setIsPhysical,taint,isPhys={1}", LocalID, _isPhysical); | 723 | DetailLog("{0},setIsPhysical,taint,isPhys={1}", LocalID, _isPhysical); |
724 | SetObjectDynamic(true); | 724 | SetObjectDynamic(true); |
@@ -773,7 +773,7 @@ public class BSPrim : BSPhysObject | |||
773 | 773 | ||
774 | // Mangling all the physical properties requires the object not be in the physical world. | 774 | // Mangling all the physical properties requires the object not be in the physical world. |
775 | // This is a NOOP if the object is not in the world (BulletSim and Bullet ignore objects not found). | 775 | // This is a NOOP if the object is not in the world (BulletSim and Bullet ignore objects not found). |
776 | PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, PhysBody); | 776 | PhysScene.PE.RemoveObjectFromWorld(PhysScene.World, PhysBody); |
777 | 777 | ||
778 | // Set up the object physicalness (does gravity and collisions move this object) | 778 | // Set up the object physicalness (does gravity and collisions move this object) |
779 | MakeDynamic(IsStatic); | 779 | MakeDynamic(IsStatic); |
@@ -790,7 +790,7 @@ public class BSPrim : BSPhysObject | |||
790 | AddObjectToPhysicalWorld(); | 790 | AddObjectToPhysicalWorld(); |
791 | 791 | ||
792 | // Rebuild its shape | 792 | // Rebuild its shape |
793 | PhysicsScene.PE.UpdateSingleAabb(PhysicsScene.World, PhysBody); | 793 | PhysScene.PE.UpdateSingleAabb(PhysScene.World, PhysBody); |
794 | 794 | ||
795 | DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},cType={6},body={7},shape={8}", | 795 | DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},cType={6},body={7},shape={8}", |
796 | LocalID, IsStatic, IsSolid, Mass, SubscribedEvents(), | 796 | LocalID, IsStatic, IsSolid, Mass, SubscribedEvents(), |
@@ -807,28 +807,28 @@ public class BSPrim : BSPhysObject | |||
807 | if (makeStatic) | 807 | if (makeStatic) |
808 | { | 808 | { |
809 | // Become a Bullet 'static' object type | 809 | // Become a Bullet 'static' object type |
810 | CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_STATIC_OBJECT); | 810 | CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_STATIC_OBJECT); |
811 | // Stop all movement | 811 | // Stop all movement |
812 | ZeroMotion(true); | 812 | ZeroMotion(true); |
813 | 813 | ||
814 | // Set various physical properties so other object interact properly | 814 | // Set various physical properties so other object interact properly |
815 | PhysicsScene.PE.SetFriction(PhysBody, Friction); | 815 | PhysScene.PE.SetFriction(PhysBody, Friction); |
816 | PhysicsScene.PE.SetRestitution(PhysBody, Restitution); | 816 | PhysScene.PE.SetRestitution(PhysBody, Restitution); |
817 | PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold); | 817 | PhysScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold); |
818 | 818 | ||
819 | // Mass is zero which disables a bunch of physics stuff in Bullet | 819 | // Mass is zero which disables a bunch of physics stuff in Bullet |
820 | UpdatePhysicalMassProperties(0f, false); | 820 | UpdatePhysicalMassProperties(0f, false); |
821 | // Set collision detection parameters | 821 | // Set collision detection parameters |
822 | if (BSParam.CcdMotionThreshold > 0f) | 822 | if (BSParam.CcdMotionThreshold > 0f) |
823 | { | 823 | { |
824 | PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold); | 824 | PhysScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold); |
825 | PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius); | 825 | PhysScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius); |
826 | } | 826 | } |
827 | 827 | ||
828 | // The activation state is 'disabled' so Bullet will not try to act on it. | 828 | // The activation state is 'disabled' so Bullet will not try to act on it. |
829 | // PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_SIMULATION); | 829 | // PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.DISABLE_SIMULATION); |
830 | // Start it out sleeping and physical actions could wake it up. | 830 | // Start it out sleeping and physical actions could wake it up. |
831 | PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ISLAND_SLEEPING); | 831 | PhysScene.PE.ForceActivationState(PhysBody, ActivationState.ISLAND_SLEEPING); |
832 | 832 | ||
833 | // This collides like a static object | 833 | // This collides like a static object |
834 | PhysBody.collisionType = CollisionType.Static; | 834 | PhysBody.collisionType = CollisionType.Static; |
@@ -836,11 +836,11 @@ public class BSPrim : BSPhysObject | |||
836 | else | 836 | else |
837 | { | 837 | { |
838 | // Not a Bullet static object | 838 | // Not a Bullet static object |
839 | CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.CF_STATIC_OBJECT); | 839 | CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.CF_STATIC_OBJECT); |
840 | 840 | ||
841 | // Set various physical properties so other object interact properly | 841 | // Set various physical properties so other object interact properly |
842 | PhysicsScene.PE.SetFriction(PhysBody, Friction); | 842 | PhysScene.PE.SetFriction(PhysBody, Friction); |
843 | PhysicsScene.PE.SetRestitution(PhysBody, Restitution); | 843 | PhysScene.PE.SetRestitution(PhysBody, Restitution); |
844 | // DetailLog("{0},BSPrim.MakeDynamic,frict={1},rest={2}", LocalID, Friction, Restitution); | 844 | // DetailLog("{0},BSPrim.MakeDynamic,frict={1},rest={2}", LocalID, Friction, Restitution); |
845 | 845 | ||
846 | // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382 | 846 | // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382 |
@@ -858,22 +858,22 @@ public class BSPrim : BSPhysObject | |||
858 | // Set collision detection parameters | 858 | // Set collision detection parameters |
859 | if (BSParam.CcdMotionThreshold > 0f) | 859 | if (BSParam.CcdMotionThreshold > 0f) |
860 | { | 860 | { |
861 | PhysicsScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold); | 861 | PhysScene.PE.SetCcdMotionThreshold(PhysBody, BSParam.CcdMotionThreshold); |
862 | PhysicsScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius); | 862 | PhysScene.PE.SetCcdSweptSphereRadius(PhysBody, BSParam.CcdSweptSphereRadius); |
863 | } | 863 | } |
864 | 864 | ||
865 | // Various values for simulation limits | 865 | // Various values for simulation limits |
866 | PhysicsScene.PE.SetDamping(PhysBody, BSParam.LinearDamping, BSParam.AngularDamping); | 866 | PhysScene.PE.SetDamping(PhysBody, BSParam.LinearDamping, BSParam.AngularDamping); |
867 | PhysicsScene.PE.SetDeactivationTime(PhysBody, BSParam.DeactivationTime); | 867 | PhysScene.PE.SetDeactivationTime(PhysBody, BSParam.DeactivationTime); |
868 | PhysicsScene.PE.SetSleepingThresholds(PhysBody, BSParam.LinearSleepingThreshold, BSParam.AngularSleepingThreshold); | 868 | PhysScene.PE.SetSleepingThresholds(PhysBody, BSParam.LinearSleepingThreshold, BSParam.AngularSleepingThreshold); |
869 | PhysicsScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold); | 869 | PhysScene.PE.SetContactProcessingThreshold(PhysBody, BSParam.ContactProcessingThreshold); |
870 | 870 | ||
871 | // This collides like an object. | 871 | // This collides like an object. |
872 | PhysBody.collisionType = CollisionType.Dynamic; | 872 | PhysBody.collisionType = CollisionType.Dynamic; |
873 | 873 | ||
874 | // Force activation of the object so Bullet will act on it. | 874 | // Force activation of the object so Bullet will act on it. |
875 | // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects. | 875 | // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects. |
876 | PhysicsScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG); | 876 | PhysScene.PE.ForceActivationState(PhysBody, ActivationState.ACTIVE_TAG); |
877 | } | 877 | } |
878 | } | 878 | } |
879 | 879 | ||
@@ -883,7 +883,7 @@ public class BSPrim : BSPhysObject | |||
883 | // the functions after this one set up the state of a possibly newly created collision body. | 883 | // the functions after this one set up the state of a possibly newly created collision body. |
884 | private void MakeSolid(bool makeSolid) | 884 | private void MakeSolid(bool makeSolid) |
885 | { | 885 | { |
886 | CollisionObjectTypes bodyType = (CollisionObjectTypes)PhysicsScene.PE.GetBodyType(PhysBody); | 886 | CollisionObjectTypes bodyType = (CollisionObjectTypes)PhysScene.PE.GetBodyType(PhysBody); |
887 | if (makeSolid) | 887 | if (makeSolid) |
888 | { | 888 | { |
889 | // Verify the previous code created the correct shape for this type of thing. | 889 | // Verify the previous code created the correct shape for this type of thing. |
@@ -891,7 +891,7 @@ public class BSPrim : BSPhysObject | |||
891 | { | 891 | { |
892 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for solidity. id={1}, type={2}", LogHeader, LocalID, bodyType); | 892 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for solidity. id={1}, type={2}", LogHeader, LocalID, bodyType); |
893 | } | 893 | } |
894 | CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE); | 894 | CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE); |
895 | } | 895 | } |
896 | else | 896 | else |
897 | { | 897 | { |
@@ -899,7 +899,7 @@ public class BSPrim : BSPhysObject | |||
899 | { | 899 | { |
900 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); | 900 | m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); |
901 | } | 901 | } |
902 | CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE); | 902 | CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.CF_NO_CONTACT_RESPONSE); |
903 | 903 | ||
904 | // Change collision info from a static object to a ghosty collision object | 904 | // Change collision info from a static object to a ghosty collision object |
905 | PhysBody.collisionType = CollisionType.VolumeDetect; | 905 | PhysBody.collisionType = CollisionType.VolumeDetect; |
@@ -911,11 +911,11 @@ public class BSPrim : BSPhysObject | |||
911 | { | 911 | { |
912 | if (wantsCollisionEvents) | 912 | if (wantsCollisionEvents) |
913 | { | 913 | { |
914 | CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | 914 | CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); |
915 | } | 915 | } |
916 | else | 916 | else |
917 | { | 917 | { |
918 | CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); | 918 | CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); |
919 | } | 919 | } |
920 | } | 920 | } |
921 | 921 | ||
@@ -926,7 +926,7 @@ public class BSPrim : BSPhysObject | |||
926 | { | 926 | { |
927 | if (PhysBody.HasPhysicalBody) | 927 | if (PhysBody.HasPhysicalBody) |
928 | { | 928 | { |
929 | PhysicsScene.PE.AddObjectToWorld(PhysicsScene.World, PhysBody); | 929 | PhysScene.PE.AddObjectToWorld(PhysScene.World, PhysBody); |
930 | } | 930 | } |
931 | else | 931 | else |
932 | { | 932 | { |
@@ -961,12 +961,12 @@ public class BSPrim : BSPhysObject | |||
961 | public override bool FloatOnWater { | 961 | public override bool FloatOnWater { |
962 | set { | 962 | set { |
963 | _floatOnWater = value; | 963 | _floatOnWater = value; |
964 | PhysicsScene.TaintedObject("BSPrim.setFloatOnWater", delegate() | 964 | PhysScene.TaintedObject("BSPrim.setFloatOnWater", delegate() |
965 | { | 965 | { |
966 | if (_floatOnWater) | 966 | if (_floatOnWater) |
967 | CurrentCollisionFlags = PhysicsScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER); | 967 | CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER); |
968 | else | 968 | else |
969 | CurrentCollisionFlags = PhysicsScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER); | 969 | CurrentCollisionFlags = PhysScene.PE.RemoveFromCollisionFlags(PhysBody, CollisionFlags.BS_FLOATS_ON_WATER); |
970 | }); | 970 | }); |
971 | } | 971 | } |
972 | } | 972 | } |
@@ -978,7 +978,7 @@ public class BSPrim : BSPhysObject | |||
978 | _rotationalVelocity = value; | 978 | _rotationalVelocity = value; |
979 | Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity); | 979 | Util.ClampV(_rotationalVelocity, BSParam.MaxAngularVelocity); |
980 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); | 980 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); |
981 | PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() | 981 | PhysScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() |
982 | { | 982 | { |
983 | ForceRotationalVelocity = _rotationalVelocity; | 983 | ForceRotationalVelocity = _rotationalVelocity; |
984 | }); | 984 | }); |
@@ -993,7 +993,7 @@ public class BSPrim : BSPhysObject | |||
993 | if (PhysBody.HasPhysicalBody) | 993 | if (PhysBody.HasPhysicalBody) |
994 | { | 994 | { |
995 | DetailLog("{0},BSPrim.ForceRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); | 995 | DetailLog("{0},BSPrim.ForceRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); |
996 | PhysicsScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); | 996 | PhysScene.PE.SetAngularVelocity(PhysBody, _rotationalVelocity); |
997 | // PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); | 997 | // PhysicsScene.PE.SetInterpolationAngularVelocity(PhysBody, _rotationalVelocity); |
998 | ActivateIfPhysical(false); | 998 | ActivateIfPhysical(false); |
999 | } | 999 | } |
@@ -1009,7 +1009,7 @@ public class BSPrim : BSPhysObject | |||
1009 | get { return _buoyancy; } | 1009 | get { return _buoyancy; } |
1010 | set { | 1010 | set { |
1011 | _buoyancy = value; | 1011 | _buoyancy = value; |
1012 | PhysicsScene.TaintedObject("BSPrim.setBuoyancy", delegate() | 1012 | PhysScene.TaintedObject("BSPrim.setBuoyancy", delegate() |
1013 | { | 1013 | { |
1014 | ForceBuoyancy = _buoyancy; | 1014 | ForceBuoyancy = _buoyancy; |
1015 | }); | 1015 | }); |
@@ -1032,7 +1032,7 @@ public class BSPrim : BSPhysObject | |||
1032 | base.MoveToTargetActive = value; | 1032 | base.MoveToTargetActive = value; |
1033 | EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate() | 1033 | EnableActor(MoveToTargetActive, MoveToTargetActorName, delegate() |
1034 | { | 1034 | { |
1035 | return new BSActorMoveToTarget(PhysicsScene, this, MoveToTargetActorName); | 1035 | return new BSActorMoveToTarget(PhysScene, this, MoveToTargetActorName); |
1036 | }); | 1036 | }); |
1037 | } | 1037 | } |
1038 | } | 1038 | } |
@@ -1044,7 +1044,7 @@ public class BSPrim : BSPhysObject | |||
1044 | base.HoverActive = value; | 1044 | base.HoverActive = value; |
1045 | EnableActor(HoverActive, HoverActorName, delegate() | 1045 | EnableActor(HoverActive, HoverActorName, delegate() |
1046 | { | 1046 | { |
1047 | return new BSActorHover(PhysicsScene, this, HoverActorName); | 1047 | return new BSActorHover(PhysScene, this, HoverActorName); |
1048 | }); | 1048 | }); |
1049 | } | 1049 | } |
1050 | } | 1050 | } |
@@ -1054,7 +1054,7 @@ public class BSPrim : BSPhysObject | |||
1054 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); | 1054 | OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); |
1055 | 1055 | ||
1056 | // Since this force is being applied in only one step, make this a force per second. | 1056 | // Since this force is being applied in only one step, make this a force per second. |
1057 | addForce /= PhysicsScene.LastTimeStep; | 1057 | addForce /= PhysScene.LastTimeStep; |
1058 | AddForce(addForce, pushforce, false /* inTaintTime */); | 1058 | AddForce(addForce, pushforce, false /* inTaintTime */); |
1059 | } | 1059 | } |
1060 | 1060 | ||
@@ -1069,13 +1069,13 @@ public class BSPrim : BSPhysObject | |||
1069 | // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); | 1069 | // DetailLog("{0},BSPrim.addForce,call,force={1}", LocalID, addForce); |
1070 | 1070 | ||
1071 | OMV.Vector3 addForce = force; | 1071 | OMV.Vector3 addForce = force; |
1072 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() | 1072 | PhysScene.TaintedObject(inTaintTime, "BSPrim.AddForce", delegate() |
1073 | { | 1073 | { |
1074 | // Bullet adds this central force to the total force for this tick | 1074 | // Bullet adds this central force to the total force for this tick |
1075 | DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce); | 1075 | DetailLog("{0},BSPrim.addForce,taint,force={1}", LocalID, addForce); |
1076 | if (PhysBody.HasPhysicalBody) | 1076 | if (PhysBody.HasPhysicalBody) |
1077 | { | 1077 | { |
1078 | PhysicsScene.PE.ApplyCentralForce(PhysBody, addForce); | 1078 | PhysScene.PE.ApplyCentralForce(PhysBody, addForce); |
1079 | ActivateIfPhysical(false); | 1079 | ActivateIfPhysical(false); |
1080 | } | 1080 | } |
1081 | }); | 1081 | }); |
@@ -1097,13 +1097,13 @@ public class BSPrim : BSPhysObject | |||
1097 | OMV.Vector3 addImpulse = Util.ClampV(impulse, BSParam.MaxAddForceMagnitude); | 1097 | OMV.Vector3 addImpulse = Util.ClampV(impulse, BSParam.MaxAddForceMagnitude); |
1098 | // DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse); | 1098 | // DetailLog("{0},BSPrim.addForceImpulse,call,impulse={1}", LocalID, impulse); |
1099 | 1099 | ||
1100 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddImpulse", delegate() | 1100 | PhysScene.TaintedObject(inTaintTime, "BSPrim.AddImpulse", delegate() |
1101 | { | 1101 | { |
1102 | // Bullet adds this impulse immediately to the velocity | 1102 | // Bullet adds this impulse immediately to the velocity |
1103 | DetailLog("{0},BSPrim.addForceImpulse,taint,impulseforce={1}", LocalID, addImpulse); | 1103 | DetailLog("{0},BSPrim.addForceImpulse,taint,impulseforce={1}", LocalID, addImpulse); |
1104 | if (PhysBody.HasPhysicalBody) | 1104 | if (PhysBody.HasPhysicalBody) |
1105 | { | 1105 | { |
1106 | PhysicsScene.PE.ApplyCentralImpulse(PhysBody, addImpulse); | 1106 | PhysScene.PE.ApplyCentralImpulse(PhysBody, addImpulse); |
1107 | ActivateIfPhysical(false); | 1107 | ActivateIfPhysical(false); |
1108 | } | 1108 | } |
1109 | }); | 1109 | }); |
@@ -1122,12 +1122,12 @@ public class BSPrim : BSPhysObject | |||
1122 | if (force.IsFinite()) | 1122 | if (force.IsFinite()) |
1123 | { | 1123 | { |
1124 | OMV.Vector3 angForce = force; | 1124 | OMV.Vector3 angForce = force; |
1125 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.AddAngularForce", delegate() | 1125 | PhysScene.TaintedObject(inTaintTime, "BSPrim.AddAngularForce", delegate() |
1126 | { | 1126 | { |
1127 | if (PhysBody.HasPhysicalBody) | 1127 | if (PhysBody.HasPhysicalBody) |
1128 | { | 1128 | { |
1129 | DetailLog("{0},BSPrim.AddAngularForce,taint,angForce={1}", LocalID, angForce); | 1129 | DetailLog("{0},BSPrim.AddAngularForce,taint,angForce={1}", LocalID, angForce); |
1130 | PhysicsScene.PE.ApplyTorque(PhysBody, angForce); | 1130 | PhysScene.PE.ApplyTorque(PhysBody, angForce); |
1131 | ActivateIfPhysical(false); | 1131 | ActivateIfPhysical(false); |
1132 | } | 1132 | } |
1133 | }); | 1133 | }); |
@@ -1146,11 +1146,11 @@ public class BSPrim : BSPhysObject | |||
1146 | public void ApplyTorqueImpulse(OMV.Vector3 impulse, bool inTaintTime) | 1146 | public void ApplyTorqueImpulse(OMV.Vector3 impulse, bool inTaintTime) |
1147 | { | 1147 | { |
1148 | OMV.Vector3 applyImpulse = impulse; | 1148 | OMV.Vector3 applyImpulse = impulse; |
1149 | PhysicsScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate() | 1149 | PhysScene.TaintedObject(inTaintTime, "BSPrim.ApplyTorqueImpulse", delegate() |
1150 | { | 1150 | { |
1151 | if (PhysBody.HasPhysicalBody) | 1151 | if (PhysBody.HasPhysicalBody) |
1152 | { | 1152 | { |
1153 | PhysicsScene.PE.ApplyTorqueImpulse(PhysBody, applyImpulse); | 1153 | PhysScene.PE.ApplyTorqueImpulse(PhysBody, applyImpulse); |
1154 | ActivateIfPhysical(false); | 1154 | ActivateIfPhysical(false); |
1155 | } | 1155 | } |
1156 | }); | 1156 | }); |
@@ -1452,7 +1452,7 @@ public class BSPrim : BSPhysObject | |||
1452 | // Create the correct physical representation for this type of object. | 1452 | // Create the correct physical representation for this type of object. |
1453 | // Updates base.PhysBody and base.PhysShape with the new information. | 1453 | // Updates base.PhysBody and base.PhysShape with the new information. |
1454 | // Ignore 'forceRebuild'. 'GetBodyAndShape' makes the right choices and changes of necessary. | 1454 | // Ignore 'forceRebuild'. 'GetBodyAndShape' makes the right choices and changes of necessary. |
1455 | PhysicsScene.Shapes.GetBodyAndShape(false /*forceRebuild */, PhysicsScene.World, this, delegate(BulletBody pBody, BulletShape pShape) | 1455 | PhysScene.Shapes.GetBodyAndShape(false /*forceRebuild */, PhysScene.World, this, delegate(BulletBody pBody, BulletShape pShape) |
1456 | { | 1456 | { |
1457 | // Called if the current prim body is about to be destroyed. | 1457 | // Called if the current prim body is about to be destroyed. |
1458 | // Remove all the physical dependencies on the old body. | 1458 | // Remove all the physical dependencies on the old body. |