aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorMelanie2013-01-31 02:53:11 +0000
committerMelanie2013-01-31 02:53:11 +0000
commit9a4de546fe92105c570d6861377ec47d32b4186e (patch)
treeedfb86074fc7c78126203a2c05a38e260c0d4076 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentMerge branch 'avination' into careminster (diff)
parentAdd JsonTestStore to determine if a JsonStore is associated with (diff)
downloadopensim-SC_OLD-9a4de546fe92105c570d6861377ec47d32b4186e.zip
opensim-SC_OLD-9a4de546fe92105c570d6861377ec47d32b4186e.tar.gz
opensim-SC_OLD-9a4de546fe92105c570d6861377ec47d32b4186e.tar.bz2
opensim-SC_OLD-9a4de546fe92105c570d6861377ec47d32b4186e.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs48
1 files changed, 26 insertions, 22 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 8b00a33..b5dd131 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -59,7 +59,6 @@ public sealed class BSPrim : BSPhysObject
59 private OMV.Vector3 _force; 59 private OMV.Vector3 _force;
60 private OMV.Vector3 _velocity; 60 private OMV.Vector3 _velocity;
61 private OMV.Vector3 _torque; 61 private OMV.Vector3 _torque;
62 private float _collisionScore;
63 private OMV.Vector3 _acceleration; 62 private OMV.Vector3 _acceleration;
64 private OMV.Quaternion _orientation; 63 private OMV.Quaternion _orientation;
65 private int _physicsActorType; 64 private int _physicsActorType;
@@ -74,7 +73,7 @@ public sealed class BSPrim : BSPhysObject
74 private bool _kinematic; 73 private bool _kinematic;
75 private float _buoyancy; 74 private float _buoyancy;
76 75
77 private BSDynamics _vehicle; 76 public BSDynamics VehicleController { get; private set; }
78 77
79 private BSVMotor _targetMotor; 78 private BSVMotor _targetMotor;
80 private OMV.Vector3 _PIDTarget; 79 private OMV.Vector3 _PIDTarget;
@@ -108,7 +107,7 @@ public sealed class BSPrim : BSPhysObject
108 _friction = PhysicsScene.Params.defaultFriction; 107 _friction = PhysicsScene.Params.defaultFriction;
109 _restitution = PhysicsScene.Params.defaultRestitution; 108 _restitution = PhysicsScene.Params.defaultRestitution;
110 109
111 _vehicle = new BSDynamics(PhysicsScene, this); // add vehicleness 110 VehicleController = new BSDynamics(PhysicsScene, this); // add vehicleness
112 111
113 _mass = CalculateMass(); 112 _mass = CalculateMass();
114 113
@@ -345,6 +344,10 @@ public sealed class BSPrim : BSPhysObject
345 { 344 {
346 bool ret = false; 345 bool ret = false;
347 346
347 // We don't care where non-physical items are placed
348 if (!IsPhysicallyActive)
349 return ret;
350
348 if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(RawPosition)) 351 if (!PhysicsScene.TerrainManager.IsWithinKnownTerrain(RawPosition))
349 { 352 {
350 // The physical object is out of the known/simulated area. 353 // The physical object is out of the known/simulated area.
@@ -513,7 +516,7 @@ public sealed class BSPrim : BSPhysObject
513 516
514 public override int VehicleType { 517 public override int VehicleType {
515 get { 518 get {
516 return (int)_vehicle.Type; // if we are a vehicle, return that type 519 return (int)VehicleController.Type; // if we are a vehicle, return that type
517 } 520 }
518 set { 521 set {
519 Vehicle type = (Vehicle)value; 522 Vehicle type = (Vehicle)value;
@@ -522,14 +525,20 @@ public sealed class BSPrim : BSPhysObject
522 { 525 {
523 // Done at taint time so we're sure the physics engine is not using the variables 526 // Done at taint time so we're sure the physics engine is not using the variables
524 // Vehicle code changes the parameters for this vehicle type. 527 // Vehicle code changes the parameters for this vehicle type.
525 _vehicle.ProcessTypeChange(type); 528 VehicleController.ProcessTypeChange(type);
526 ActivateIfPhysical(false); 529 ActivateIfPhysical(false);
527 530
528 // If an active vehicle, register the vehicle code to be called before each step 531 // If an active vehicle, register the vehicle code to be called before each step
529 if (_vehicle.Type == Vehicle.TYPE_NONE) 532 if (VehicleController.Type == Vehicle.TYPE_NONE)
533 {
530 UnRegisterPreStepAction("BSPrim.Vehicle", LocalID); 534 UnRegisterPreStepAction("BSPrim.Vehicle", LocalID);
535 PhysicsScene.AfterStep -= VehicleController.PostStep;
536 }
531 else 537 else
532 RegisterPreStepAction("BSPrim.Vehicle", LocalID, _vehicle.Step); 538 {
539 RegisterPreStepAction("BSPrim.Vehicle", LocalID, VehicleController.Step);
540 PhysicsScene.AfterStep += VehicleController.PostStep;
541 }
533 }); 542 });
534 } 543 }
535 } 544 }
@@ -537,7 +546,7 @@ public sealed class BSPrim : BSPhysObject
537 { 546 {
538 PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() 547 PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate()
539 { 548 {
540 _vehicle.ProcessFloatVehicleParam((Vehicle)param, value); 549 VehicleController.ProcessFloatVehicleParam((Vehicle)param, value);
541 ActivateIfPhysical(false); 550 ActivateIfPhysical(false);
542 }); 551 });
543 } 552 }
@@ -545,7 +554,7 @@ public sealed class BSPrim : BSPhysObject
545 { 554 {
546 PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() 555 PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate()
547 { 556 {
548 _vehicle.ProcessVectorVehicleParam((Vehicle)param, value); 557 VehicleController.ProcessVectorVehicleParam((Vehicle)param, value);
549 ActivateIfPhysical(false); 558 ActivateIfPhysical(false);
550 }); 559 });
551 } 560 }
@@ -553,7 +562,7 @@ public sealed class BSPrim : BSPhysObject
553 { 562 {
554 PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() 563 PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate()
555 { 564 {
556 _vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); 565 VehicleController.ProcessRotationVehicleParam((Vehicle)param, rotation);
557 ActivateIfPhysical(false); 566 ActivateIfPhysical(false);
558 }); 567 });
559 } 568 }
@@ -561,7 +570,7 @@ public sealed class BSPrim : BSPhysObject
561 { 570 {
562 PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate() 571 PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate()
563 { 572 {
564 _vehicle.ProcessVehicleFlags(param, remove); 573 VehicleController.ProcessVehicleFlags(param, remove);
565 }); 574 });
566 } 575 }
567 576
@@ -638,11 +647,6 @@ public sealed class BSPrim : BSPhysObject
638 // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); 647 // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque);
639 } 648 }
640 } 649 }
641 public override float CollisionScore {
642 get { return _collisionScore; }
643 set { _collisionScore = value;
644 }
645 }
646 public override OMV.Vector3 Acceleration { 650 public override OMV.Vector3 Acceleration {
647 get { return _acceleration; } 651 get { return _acceleration; }
648 set { _acceleration = value; } 652 set { _acceleration = value; }
@@ -747,7 +751,7 @@ public sealed class BSPrim : BSPhysObject
747 // isSolid: other objects bounce off of this object 751 // isSolid: other objects bounce off of this object
748 // isVolumeDetect: other objects pass through but can generate collisions 752 // isVolumeDetect: other objects pass through but can generate collisions
749 // collisionEvents: whether this object returns collision events 753 // collisionEvents: whether this object returns collision events
750 private void UpdatePhysicalParameters() 754 public void UpdatePhysicalParameters()
751 { 755 {
752 // DetailLog("{0},BSPrim.UpdatePhysicalParameters,entry,body={1},shape={2}", LocalID, BSBody, BSShape); 756 // DetailLog("{0},BSPrim.UpdatePhysicalParameters,entry,body={1},shape={2}", LocalID, BSBody, BSShape);
753 757
@@ -759,7 +763,7 @@ public sealed class BSPrim : BSPhysObject
759 MakeDynamic(IsStatic); 763 MakeDynamic(IsStatic);
760 764
761 // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters) 765 // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters)
762 _vehicle.Refresh(); 766 VehicleController.Refresh();
763 767
764 // Arrange for collision events if the simulator wants them 768 // Arrange for collision events if the simulator wants them
765 EnableCollisions(SubscribedEvents()); 769 EnableCollisions(SubscribedEvents());
@@ -1601,7 +1605,7 @@ public sealed class BSPrim : BSPhysObject
1601 // Remove all the physical dependencies on the old body. 1605 // Remove all the physical dependencies on the old body.
1602 // (Maybe someday make the changing of BSShape an event to be subscribed to by BSLinkset, ...) 1606 // (Maybe someday make the changing of BSShape an event to be subscribed to by BSLinkset, ...)
1603 Linkset.RemoveBodyDependencies(this); 1607 Linkset.RemoveBodyDependencies(this);
1604 _vehicle.RemoveBodyDependencies(this); 1608 VehicleController.RemoveBodyDependencies(this);
1605 }); 1609 });
1606 1610
1607 // Make sure the properties are set on the new object 1611 // Make sure the properties are set on the new object
@@ -1618,9 +1622,9 @@ public sealed class BSPrim : BSPhysObject
1618 { 1622 {
1619 // A temporary kludge to suppress the rotational effects introduced on vehicles by Bullet 1623 // A temporary kludge to suppress the rotational effects introduced on vehicles by Bullet
1620 // TODO: handle physics introduced by Bullet with computed vehicle physics. 1624 // TODO: handle physics introduced by Bullet with computed vehicle physics.
1621 if (_vehicle.IsActive) 1625 if (VehicleController.IsActive)
1622 { 1626 {
1623 // entprop.RotationalVelocity = OMV.Vector3.Zero; 1627 entprop.RotationalVelocity = OMV.Vector3.Zero;
1624 } 1628 }
1625 1629
1626 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG 1630 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG
@@ -1643,7 +1647,7 @@ public sealed class BSPrim : BSPhysObject
1643 // DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG 1647 // DetailLog("{0},BSPrim.UpdateProperties,afterAssign,entprop={1}", LocalID, entprop); // DEBUG DEBUG
1644 1648
1645 // The sanity check can change the velocity and/or position. 1649 // The sanity check can change the velocity and/or position.
1646 if (IsPhysical && PositionSanityCheck(true /* inTaintTime */ )) 1650 if (PositionSanityCheck(true /* inTaintTime */ ))
1647 { 1651 {
1648 entprop.Position = _position; 1652 entprop.Position = _position;
1649 entprop.Velocity = _velocity; 1653 entprop.Velocity = _velocity;