aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2012-10-02 11:06:07 -0700
committerRobert Adams2012-10-02 11:14:09 -0700
commitce47d0c4541159a730b2d83a7b2ccffc908d06f1 (patch)
treea45efbb6da0cbfa63cfd75c17fcd9827a1086817 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentBulletSim: Fix problem where box shapes were not being rebuilt if the shape t... (diff)
downloadopensim-SC-ce47d0c4541159a730b2d83a7b2ccffc908d06f1.zip
opensim-SC-ce47d0c4541159a730b2d83a7b2ccffc908d06f1.tar.gz
opensim-SC-ce47d0c4541159a730b2d83a7b2ccffc908d06f1.tar.bz2
opensim-SC-ce47d0c4541159a730b2d83a7b2ccffc908d06f1.tar.xz
BulletSim: Add ForcePosition and ForceOrientation to BSPhysObject and to its children of BSPrim and BSCharacter.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs39
1 files changed, 34 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index e37a4a0..f7b68ba 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -275,6 +275,17 @@ public sealed class BSPrim : BSPhysObject
275 }); 275 });
276 } 276 }
277 } 277 }
278 public override OMV.Vector3 ForcePosition {
279 get {
280 _position = BulletSimAPI.GetPosition2(BSBody.ptr);
281 return _position;
282 }
283 set {
284 _position = value;
285 PositionSanityCheck();
286 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation);
287 }
288 }
278 289
279 // Check that the current position is sane and, if not, modify the position to make it so. 290 // Check that the current position is sane and, if not, modify the position to make it so.
280 // Check for being below terrain and being out of bounds. 291 // Check for being below terrain and being out of bounds.
@@ -377,14 +388,15 @@ public sealed class BSPrim : BSPhysObject
377 } 388 }
378 set { 389 set {
379 Vehicle type = (Vehicle)value; 390 Vehicle type = (Vehicle)value;
380 BSPrim vehiclePrim = this; 391
392 // Tell the scene about the vehicle so it will get processing each frame.
393 PhysicsScene.VehicleInSceneTypeChanged(this, type);
394
381 PhysicsScene.TaintedObject("setVehicleType", delegate() 395 PhysicsScene.TaintedObject("setVehicleType", delegate()
382 { 396 {
383 // Done at taint time so we're sure the physics engine is not using the variables 397 // Done at taint time so we're sure the physics engine is not using the variables
384 // Vehicle code changes the parameters for this vehicle type. 398 // Vehicle code changes the parameters for this vehicle type.
385 _vehicle.ProcessTypeChange(type); 399 this._vehicle.ProcessTypeChange(type);
386 // Tell the scene about the vehicle so it will get processing each frame.
387 PhysicsScene.VehicleInSceneTypeChanged(this, type);
388 }); 400 });
389 } 401 }
390 } 402 }
@@ -422,7 +434,9 @@ public sealed class BSPrim : BSPhysObject
422 public override void StepVehicle(float timeStep) 434 public override void StepVehicle(float timeStep)
423 { 435 {
424 if (IsPhysical) 436 if (IsPhysical)
437 {
425 _vehicle.Step(timeStep); 438 _vehicle.Step(timeStep);
439 }
426 } 440 }
427 441
428 // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more 442 // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
@@ -486,6 +500,20 @@ public sealed class BSPrim : BSPhysObject
486 }); 500 });
487 } 501 }
488 } 502 }
503 // Go directly to Bullet to get/set the value.
504 public override OMV.Quaternion ForceOrientation
505 {
506 get
507 {
508 _orientation = BulletSimAPI.GetOrientation2(BSBody.ptr);
509 return _orientation;
510 }
511 set
512 {
513 _orientation = value;
514 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation);
515 }
516 }
489 public override int PhysicsActorType { 517 public override int PhysicsActorType {
490 get { return _physicsActorType; } 518 get { return _physicsActorType; }
491 set { _physicsActorType = value; } 519 set { _physicsActorType = value; }
@@ -1170,7 +1198,8 @@ public sealed class BSPrim : BSPhysObject
1170 1198
1171 // Create the correct physical representation for this type of object. 1199 // Create the correct physical representation for this type of object.
1172 // Updates BSBody and BSShape with the new information. 1200 // Updates BSBody and BSShape with the new information.
1173 PhysicsScene.Shapes.GetBodyAndShape(forceRebuild, PhysicsScene.World, this, shapeData, _pbs, 1201 // Ignore 'forceRebuild'. This routine makes the right choices and changes of necessary.
1202 PhysicsScene.Shapes.GetBodyAndShape(false, PhysicsScene.World, this, shapeData, _pbs,
1174 null, delegate(BulletBody dBody) 1203 null, delegate(BulletBody dBody)
1175 { 1204 {
1176 // Called if the current prim body is about to be destroyed. 1205 // Called if the current prim body is about to be destroyed.