diff options
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 149 | ||||
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 11 |
2 files changed, 126 insertions, 34 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 61d5a1d..f2f4725 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -161,9 +161,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
161 | 161 | ||
162 | private List<OdePrim> childrenPrim = new List<OdePrim>(); | 162 | private List<OdePrim> childrenPrim = new List<OdePrim>(); |
163 | 163 | ||
164 | |||
165 | // private bool m_throttleUpdates; | ||
166 | // private int throttleCounter; | ||
167 | public float m_collisionscore; | 164 | public float m_collisionscore; |
168 | private int m_colliderfilter = 0; | 165 | private int m_colliderfilter = 0; |
169 | 166 | ||
@@ -175,7 +172,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
175 | private bool m_lastUpdateSent; | 172 | private bool m_lastUpdateSent; |
176 | 173 | ||
177 | public IntPtr Body = IntPtr.Zero; | 174 | public IntPtr Body = IntPtr.Zero; |
178 | // public String Name { get; private set; } | 175 | |
179 | private Vector3 _target_velocity; | 176 | private Vector3 _target_velocity; |
180 | 177 | ||
181 | public Vector3 primOOBsize; // prim real dimensions from mesh | 178 | public Vector3 primOOBsize; // prim real dimensions from mesh |
@@ -366,12 +363,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
366 | 363 | ||
367 | 364 | ||
368 | public override bool ThrottleUpdates {get;set;} | 365 | public override bool ThrottleUpdates {get;set;} |
369 | /* | 366 | |
370 | { | ||
371 | get { return m_throttleUpdates; } | ||
372 | set { m_throttleUpdates = value; } | ||
373 | } | ||
374 | */ | ||
375 | public override bool Stopped | 367 | public override bool Stopped |
376 | { | 368 | { |
377 | get { return _zeroFlag; } | 369 | get { return _zeroFlag; } |
@@ -418,7 +410,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
418 | 410 | ||
419 | public override Vector3 Force | 411 | public override Vector3 Force |
420 | { | 412 | { |
421 | //get { return Vector3.Zero; } | ||
422 | get { return m_force; } | 413 | get { return m_force; } |
423 | set | 414 | set |
424 | { | 415 | { |
@@ -673,7 +664,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
673 | get { return m_buoyancy; } | 664 | get { return m_buoyancy; } |
674 | set | 665 | set |
675 | { | 666 | { |
676 | m_buoyancy = value; | 667 | AddChange(changes.Buoyancy,value); |
677 | } | 668 | } |
678 | } | 669 | } |
679 | 670 | ||
@@ -691,28 +682,35 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
691 | { | 682 | { |
692 | if (value.IsFinite()) | 683 | if (value.IsFinite()) |
693 | { | 684 | { |
694 | m_PIDTarget = value; | 685 | AddChange(changes.PIDTarget,value); |
695 | } | 686 | } |
696 | else | 687 | else |
697 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); | 688 | m_log.WarnFormat("[PHYSICS]: Got NaN PIDTarget from Scene on Object {0}", Name); |
698 | } | 689 | } |
699 | } | 690 | } |
700 | 691 | ||
701 | public override bool PIDActive { set { m_usePID = value; } } | 692 | public override bool PIDActive |
693 | { | ||
694 | set | ||
695 | { | ||
696 | AddChange(changes.PIDActive,value); | ||
697 | } | ||
698 | } | ||
699 | |||
702 | public override float PIDTau | 700 | public override float PIDTau |
703 | { | 701 | { |
704 | set | 702 | set |
705 | { | 703 | { |
706 | if (value <= 0) | 704 | float tmp = 0; |
707 | m_PIDTau = 0; | 705 | if (value > 0) |
708 | else | ||
709 | { | 706 | { |
710 | float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep); | 707 | float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep); |
711 | if (value < mint) | 708 | if (value < mint) |
712 | m_PIDTau = mint; | 709 | tmp = mint; |
713 | else | 710 | else |
714 | m_PIDTau = value; | 711 | tmp = value; |
715 | } | 712 | } |
713 | AddChange(changes.PIDTau,tmp); | ||
716 | } | 714 | } |
717 | } | 715 | } |
718 | 716 | ||
@@ -720,27 +718,39 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
720 | { | 718 | { |
721 | set | 719 | set |
722 | { | 720 | { |
723 | m_PIDHoverHeight = value; | 721 | AddChange(changes.PIDHoverHeight,value); |
724 | if (value == 0) | 722 | } |
725 | m_useHoverPID = false; | 723 | } |
724 | public override bool PIDHoverActive | ||
725 | { | ||
726 | set | ||
727 | { | ||
728 | AddChange(changes.PIDHoverActive, value); | ||
726 | } | 729 | } |
727 | } | 730 | } |
728 | public override bool PIDHoverActive { set { m_useHoverPID = value; } } | 731 | |
729 | public override PIDHoverType PIDHoverType { set { m_PIDHoverType = value; } } | 732 | public override PIDHoverType PIDHoverType |
733 | { | ||
734 | set | ||
735 | { | ||
736 | AddChange(changes.PIDHoverType,value); | ||
737 | } | ||
738 | } | ||
739 | |||
730 | public override float PIDHoverTau | 740 | public override float PIDHoverTau |
731 | { | 741 | { |
732 | set | 742 | set |
733 | { | 743 | { |
734 | if (value <= 0) | 744 | float tmp =0; |
735 | m_PIDHoverTau = 0; | 745 | if (value > 0) |
736 | else | ||
737 | { | 746 | { |
738 | float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep); | 747 | float mint = (0.05f > m_timeStep ? 0.05f : m_timeStep); |
739 | if (value < mint) | 748 | if (value < mint) |
740 | m_PIDHoverTau = mint; | 749 | tmp = mint; |
741 | else | 750 | else |
742 | m_PIDHoverTau = value; | 751 | tmp = value; |
743 | } | 752 | } |
753 | AddChange(changes.PIDHoverTau, tmp); | ||
744 | } | 754 | } |
745 | } | 755 | } |
746 | 756 | ||
@@ -981,7 +991,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
981 | return false; | 991 | return false; |
982 | } | 992 | } |
983 | 993 | ||
984 | |||
985 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, | 994 | public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, |
986 | Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID) | 995 | Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom,byte _shapeType,uint plocalID) |
987 | { | 996 | { |
@@ -3099,7 +3108,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3099 | resetCollisionAccounting(); | 3108 | resetCollisionAccounting(); |
3100 | } | 3109 | } |
3101 | 3110 | ||
3102 | |||
3103 | private void changeDisable(bool disable) | 3111 | private void changeDisable(bool disable) |
3104 | { | 3112 | { |
3105 | if (disable) | 3113 | if (disable) |
@@ -3250,7 +3258,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3250 | d.BodyEnable(Body); | 3258 | d.BodyEnable(Body); |
3251 | } | 3259 | } |
3252 | 3260 | ||
3253 | |||
3254 | private void changeAddForce(Vector3 theforce) | 3261 | private void changeAddForce(Vector3 theforce) |
3255 | { | 3262 | { |
3256 | m_forceacc += theforce; | 3263 | m_forceacc += theforce; |
@@ -3267,7 +3274,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3267 | d.BodyEnable(Body); | 3274 | d.BodyEnable(Body); |
3268 | } | 3275 | } |
3269 | } | 3276 | } |
3270 | |||
3271 | m_collisionscore = 0; | 3277 | m_collisionscore = 0; |
3272 | } | 3278 | } |
3273 | } | 3279 | } |
@@ -3317,7 +3323,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3317 | _velocity = newVel; | 3323 | _velocity = newVel; |
3318 | } | 3324 | } |
3319 | 3325 | ||
3320 | |||
3321 | private void changeangvelocity(Vector3 newAngVel) | 3326 | private void changeangvelocity(Vector3 newAngVel) |
3322 | { | 3327 | { |
3323 | float len = newAngVel.LengthSquared(); | 3328 | float len = newAngVel.LengthSquared(); |
@@ -3384,6 +3389,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3384 | m_vehicle = new ODEDynamics(this); | 3389 | m_vehicle = new ODEDynamics(this); |
3385 | m_vehicle.DoSetVehicle(vdata); | 3390 | m_vehicle.DoSetVehicle(vdata); |
3386 | } | 3391 | } |
3392 | |||
3387 | private void changeVehicleType(int value) | 3393 | private void changeVehicleType(int value) |
3388 | { | 3394 | { |
3389 | if (value == (int)Vehicle.TYPE_NONE) | 3395 | if (value == (int)Vehicle.TYPE_NONE) |
@@ -3429,6 +3435,48 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3429 | m_vehicle.ProcessVehicleFlags(bp.param, bp.value); | 3435 | m_vehicle.ProcessVehicleFlags(bp.param, bp.value); |
3430 | } | 3436 | } |
3431 | 3437 | ||
3438 | private void changeBuoyancy(float b) | ||
3439 | { | ||
3440 | m_buoyancy = b; | ||
3441 | } | ||
3442 | |||
3443 | private void changePIDTarget(Vector3 trg) | ||
3444 | { | ||
3445 | m_PIDTarget = trg; | ||
3446 | } | ||
3447 | |||
3448 | private void changePIDTau(float tau) | ||
3449 | { | ||
3450 | m_PIDTau = tau; | ||
3451 | } | ||
3452 | |||
3453 | private void changePIDActive(bool val) | ||
3454 | { | ||
3455 | m_usePID = val; | ||
3456 | } | ||
3457 | |||
3458 | private void changePIDHoverHeight(float val) | ||
3459 | { | ||
3460 | m_PIDHoverHeight = val; | ||
3461 | if (val == 0) | ||
3462 | m_useHoverPID = false; | ||
3463 | } | ||
3464 | |||
3465 | private void changePIDHoverType(PIDHoverType type) | ||
3466 | { | ||
3467 | m_PIDHoverType = type; | ||
3468 | } | ||
3469 | |||
3470 | private void changePIDHoverTau(float tau) | ||
3471 | { | ||
3472 | m_PIDHoverTau = tau; | ||
3473 | } | ||
3474 | |||
3475 | private void changePIDHoverActive(bool active) | ||
3476 | { | ||
3477 | m_useHoverPID = active; | ||
3478 | } | ||
3479 | |||
3432 | #endregion | 3480 | #endregion |
3433 | 3481 | ||
3434 | public void Move() | 3482 | public void Move() |
@@ -3987,6 +4035,39 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3987 | case changes.SetVehicle: | 4035 | case changes.SetVehicle: |
3988 | changeSetVehicle((VehicleData) arg); | 4036 | changeSetVehicle((VehicleData) arg); |
3989 | break; | 4037 | break; |
4038 | |||
4039 | case changes.Buoyancy: | ||
4040 | changeBuoyancy((float)arg); | ||
4041 | break; | ||
4042 | |||
4043 | case changes.PIDTarget: | ||
4044 | changePIDTarget((Vector3)arg); | ||
4045 | break; | ||
4046 | |||
4047 | case changes.PIDTau: | ||
4048 | changePIDTau((float)arg); | ||
4049 | break; | ||
4050 | |||
4051 | case changes.PIDActive: | ||
4052 | changePIDActive((bool)arg); | ||
4053 | break; | ||
4054 | |||
4055 | case changes.PIDHoverHeight: | ||
4056 | changePIDHoverHeight((float)arg); | ||
4057 | break; | ||
4058 | |||
4059 | case changes.PIDHoverType: | ||
4060 | changePIDHoverType((PIDHoverType)arg); | ||
4061 | break; | ||
4062 | |||
4063 | case changes.PIDHoverTau: | ||
4064 | changePIDHoverTau((float)arg); | ||
4065 | break; | ||
4066 | |||
4067 | case changes.PIDHoverActive: | ||
4068 | changePIDHoverActive((bool)arg); | ||
4069 | break; | ||
4070 | |||
3990 | case changes.Null: | 4071 | case changes.Null: |
3991 | donullchange(); | 4072 | donullchange(); |
3992 | break; | 4073 | break; |
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 3ee5198..f126644 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -134,6 +134,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
134 | AddAngForce, | 134 | AddAngForce, |
135 | AngLock, | 135 | AngLock, |
136 | 136 | ||
137 | Buoyancy, | ||
138 | |||
139 | PIDTarget, | ||
140 | PIDTau, | ||
141 | PIDActive, | ||
142 | |||
143 | PIDHoverHeight, | ||
144 | PIDHoverType, | ||
145 | PIDHoverTau, | ||
146 | PIDHoverActive, | ||
147 | |||
137 | Size, | 148 | Size, |
138 | Shape, | 149 | Shape, |
139 | 150 | ||