diff options
author | Robert Adams | 2013-02-21 08:52:11 -0800 |
---|---|---|
committer | Robert Adams | 2013-02-21 08:52:11 -0800 |
commit | efb5da0aa672551a8a68e16066f3dd3991f75da4 (patch) | |
tree | 713c0f254a512f18e3025afc0b8d0621bade92c7 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |
parent | Add a method to IStatsCollector for returning stats as an OSDMap. (diff) | |
download | opensim-SC_OLD-efb5da0aa672551a8a68e16066f3dd3991f75da4.zip opensim-SC_OLD-efb5da0aa672551a8a68e16066f3dd3991f75da4.tar.gz opensim-SC_OLD-efb5da0aa672551a8a68e16066f3dd3991f75da4.tar.bz2 opensim-SC_OLD-efb5da0aa672551a8a68e16066f3dd3991f75da4.tar.xz |
BulletSim: add OutOfBounds logic and some position sanity checking
to eliminate some of the "cannot find terrain height" warning messages.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 4d61ad2..4dff927 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -70,6 +70,8 @@ public class BSPrim : BSPhysObject | |||
70 | private bool _kinematic; | 70 | private bool _kinematic; |
71 | private float _buoyancy; | 71 | private float _buoyancy; |
72 | 72 | ||
73 | private int CrossingFailures { get; set; } | ||
74 | |||
73 | public BSDynamics VehicleController { get; private set; } | 75 | public BSDynamics VehicleController { get; private set; } |
74 | 76 | ||
75 | private BSVMotor _targetMotor; | 77 | private BSVMotor _targetMotor; |
@@ -197,7 +199,20 @@ public class BSPrim : BSPhysObject | |||
197 | { | 199 | { |
198 | get { return _isSelected; } | 200 | get { return _isSelected; } |
199 | } | 201 | } |
200 | public override void CrossingFailure() { return; } | 202 | |
203 | public override void CrossingFailure() | ||
204 | { | ||
205 | CrossingFailures++; | ||
206 | if (CrossingFailures > BSParam.CrossingFailuresBeforeOutOfBounds) | ||
207 | { | ||
208 | base.RaiseOutOfBounds(RawPosition); | ||
209 | } | ||
210 | else if (CrossingFailures == BSParam.CrossingFailuresBeforeOutOfBounds) | ||
211 | { | ||
212 | m_log.WarnFormat("{0} Too many crossing failures for {1}", LogHeader, Name); | ||
213 | } | ||
214 | return; | ||
215 | } | ||
201 | 216 | ||
202 | // link me to the specified parent | 217 | // link me to the specified parent |
203 | public override void link(PhysicsActor obj) { | 218 | public override void link(PhysicsActor obj) { |
@@ -1123,7 +1138,11 @@ public class BSPrim : BSPhysObject | |||
1123 | 1138 | ||
1124 | // Used for MoveTo | 1139 | // Used for MoveTo |
1125 | public override OMV.Vector3 PIDTarget { | 1140 | public override OMV.Vector3 PIDTarget { |
1126 | set { _PIDTarget = value; } | 1141 | set |
1142 | { | ||
1143 | // TODO: add a sanity check -- don't move more than a region or something like that. | ||
1144 | _PIDTarget = value; | ||
1145 | } | ||
1127 | } | 1146 | } |
1128 | public override float PIDTau { | 1147 | public override float PIDTau { |
1129 | set { _PIDTau = value; } | 1148 | set { _PIDTau = value; } |
@@ -1177,7 +1196,9 @@ public class BSPrim : BSPhysObject | |||
1177 | } | 1196 | } |
1178 | else | 1197 | else |
1179 | { | 1198 | { |
1180 | ForcePosition = movePosition; | 1199 | _position = movePosition; |
1200 | PositionSanityCheck(true /* intaintTime */); | ||
1201 | ForcePosition = _position; | ||
1181 | } | 1202 | } |
1182 | DetailLog("{0},BSPrim.PIDTarget,move,fromPos={1},movePos={2}", LocalID, origPosition, movePosition); | 1203 | DetailLog("{0},BSPrim.PIDTarget,move,fromPos={1},movePos={2}", LocalID, origPosition, movePosition); |
1183 | }); | 1204 | }); |