aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs42
1 files changed, 21 insertions, 21 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 8b00a33..2b0a539 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
@@ -513,7 +512,7 @@ public sealed class BSPrim : BSPhysObject
513 512
514 public override int VehicleType { 513 public override int VehicleType {
515 get { 514 get {
516 return (int)_vehicle.Type; // if we are a vehicle, return that type 515 return (int)VehicleController.Type; // if we are a vehicle, return that type
517 } 516 }
518 set { 517 set {
519 Vehicle type = (Vehicle)value; 518 Vehicle type = (Vehicle)value;
@@ -522,14 +521,20 @@ public sealed class BSPrim : BSPhysObject
522 { 521 {
523 // Done at taint time so we're sure the physics engine is not using the variables 522 // 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. 523 // Vehicle code changes the parameters for this vehicle type.
525 _vehicle.ProcessTypeChange(type); 524 VehicleController.ProcessTypeChange(type);
526 ActivateIfPhysical(false); 525 ActivateIfPhysical(false);
527 526
528 // If an active vehicle, register the vehicle code to be called before each step 527 // If an active vehicle, register the vehicle code to be called before each step
529 if (_vehicle.Type == Vehicle.TYPE_NONE) 528 if (VehicleController.Type == Vehicle.TYPE_NONE)
529 {
530 UnRegisterPreStepAction("BSPrim.Vehicle", LocalID); 530 UnRegisterPreStepAction("BSPrim.Vehicle", LocalID);
531 PhysicsScene.AfterStep -= VehicleController.PostStep;
532 }
531 else 533 else
532 RegisterPreStepAction("BSPrim.Vehicle", LocalID, _vehicle.Step); 534 {
535 RegisterPreStepAction("BSPrim.Vehicle", LocalID, VehicleController.Step);
536 PhysicsScene.AfterStep += VehicleController.PostStep;
537 }
533 }); 538 });
534 } 539 }
535 } 540 }
@@ -537,7 +542,7 @@ public sealed class BSPrim : BSPhysObject
537 { 542 {
538 PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() 543 PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate()
539 { 544 {
540 _vehicle.ProcessFloatVehicleParam((Vehicle)param, value); 545 VehicleController.ProcessFloatVehicleParam((Vehicle)param, value);
541 ActivateIfPhysical(false); 546 ActivateIfPhysical(false);
542 }); 547 });
543 } 548 }
@@ -545,7 +550,7 @@ public sealed class BSPrim : BSPhysObject
545 { 550 {
546 PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() 551 PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate()
547 { 552 {
548 _vehicle.ProcessVectorVehicleParam((Vehicle)param, value); 553 VehicleController.ProcessVectorVehicleParam((Vehicle)param, value);
549 ActivateIfPhysical(false); 554 ActivateIfPhysical(false);
550 }); 555 });
551 } 556 }
@@ -553,7 +558,7 @@ public sealed class BSPrim : BSPhysObject
553 { 558 {
554 PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() 559 PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate()
555 { 560 {
556 _vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); 561 VehicleController.ProcessRotationVehicleParam((Vehicle)param, rotation);
557 ActivateIfPhysical(false); 562 ActivateIfPhysical(false);
558 }); 563 });
559 } 564 }
@@ -561,7 +566,7 @@ public sealed class BSPrim : BSPhysObject
561 { 566 {
562 PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate() 567 PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate()
563 { 568 {
564 _vehicle.ProcessVehicleFlags(param, remove); 569 VehicleController.ProcessVehicleFlags(param, remove);
565 }); 570 });
566 } 571 }
567 572
@@ -638,11 +643,6 @@ public sealed class BSPrim : BSPhysObject
638 // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); 643 // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque);
639 } 644 }
640 } 645 }
641 public override float CollisionScore {
642 get { return _collisionScore; }
643 set { _collisionScore = value;
644 }
645 }
646 public override OMV.Vector3 Acceleration { 646 public override OMV.Vector3 Acceleration {
647 get { return _acceleration; } 647 get { return _acceleration; }
648 set { _acceleration = value; } 648 set { _acceleration = value; }
@@ -747,7 +747,7 @@ public sealed class BSPrim : BSPhysObject
747 // isSolid: other objects bounce off of this object 747 // isSolid: other objects bounce off of this object
748 // isVolumeDetect: other objects pass through but can generate collisions 748 // isVolumeDetect: other objects pass through but can generate collisions
749 // collisionEvents: whether this object returns collision events 749 // collisionEvents: whether this object returns collision events
750 private void UpdatePhysicalParameters() 750 public void UpdatePhysicalParameters()
751 { 751 {
752 // DetailLog("{0},BSPrim.UpdatePhysicalParameters,entry,body={1},shape={2}", LocalID, BSBody, BSShape); 752 // DetailLog("{0},BSPrim.UpdatePhysicalParameters,entry,body={1},shape={2}", LocalID, BSBody, BSShape);
753 753
@@ -759,7 +759,7 @@ public sealed class BSPrim : BSPhysObject
759 MakeDynamic(IsStatic); 759 MakeDynamic(IsStatic);
760 760
761 // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters) 761 // Update vehicle specific parameters (after MakeDynamic() so can change physical parameters)
762 _vehicle.Refresh(); 762 VehicleController.Refresh();
763 763
764 // Arrange for collision events if the simulator wants them 764 // Arrange for collision events if the simulator wants them
765 EnableCollisions(SubscribedEvents()); 765 EnableCollisions(SubscribedEvents());
@@ -1601,7 +1601,7 @@ public sealed class BSPrim : BSPhysObject
1601 // Remove all the physical dependencies on the old body. 1601 // 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, ...) 1602 // (Maybe someday make the changing of BSShape an event to be subscribed to by BSLinkset, ...)
1603 Linkset.RemoveBodyDependencies(this); 1603 Linkset.RemoveBodyDependencies(this);
1604 _vehicle.RemoveBodyDependencies(this); 1604 VehicleController.RemoveBodyDependencies(this);
1605 }); 1605 });
1606 1606
1607 // Make sure the properties are set on the new object 1607 // Make sure the properties are set on the new object
@@ -1618,9 +1618,9 @@ public sealed class BSPrim : BSPhysObject
1618 { 1618 {
1619 // A temporary kludge to suppress the rotational effects introduced on vehicles by Bullet 1619 // A temporary kludge to suppress the rotational effects introduced on vehicles by Bullet
1620 // TODO: handle physics introduced by Bullet with computed vehicle physics. 1620 // TODO: handle physics introduced by Bullet with computed vehicle physics.
1621 if (_vehicle.IsActive) 1621 if (VehicleController.IsActive)
1622 { 1622 {
1623 // entprop.RotationalVelocity = OMV.Vector3.Zero; 1623 entprop.RotationalVelocity = OMV.Vector3.Zero;
1624 } 1624 }
1625 1625
1626 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG 1626 // DetailLog("{0},BSPrim.UpdateProperties,entry,entprop={1}", LocalID, entprop); // DEBUG DEBUG