aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs56
1 files changed, 25 insertions, 31 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index d4f5c63..8149a53 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -205,6 +205,8 @@ public class BSCharacter : PhysicsActor
205 } 205 }
206 set { 206 set {
207 _position = value; 207 _position = value;
208 PositionSanityCheck();
209
208 _scene.TaintedObject(delegate() 210 _scene.TaintedObject(delegate()
209 { 211 {
210 DetailLog("{0},SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 212 DetailLog("{0},SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
@@ -212,6 +214,28 @@ public class BSCharacter : PhysicsActor
212 }); 214 });
213 } 215 }
214 } 216 }
217
218 // Check that the current position is sane and, if not, modify the position to make it so.
219 // Check for being below terrain and being out of bounds.
220 // Returns 'true' of the position was made sane by some action.
221 private bool PositionSanityCheck()
222 {
223 bool ret = false;
224
225 // If below the ground, move the avatar up
226 float terrainHeight = Scene.GetTerrainHeightAtXYZ(_position);
227 if (_position.Z < terrainHeight)
228 {
229 DetailLog("{0},PositionAdjustUnderGround,call,pos={1},orient={2}", LocalID, _position, _orientation);
230 _position.Z = terrainHeight + 2.0f;
231 ret = true;
232 }
233
234 // TODO: check for out of bounds
235
236 return ret;
237 }
238
215 public override float Mass { 239 public override float Mass {
216 get { 240 get {
217 return _mass; 241 return _mass;
@@ -456,42 +480,12 @@ public class BSCharacter : PhysicsActor
456 // the world that things have changed. 480 // the world that things have changed.
457 public void UpdateProperties(EntityProperties entprop) 481 public void UpdateProperties(EntityProperties entprop)
458 { 482 {
459 /*
460 bool changed = false;
461 // we assign to the local variables so the normal set action does not happen
462 if (_position != entprop.Position) {
463 _position = entprop.Position;
464 changed = true;
465 }
466 if (_orientation != entprop.Rotation) {
467 _orientation = entprop.Rotation;
468 changed = true;
469 }
470 if (_velocity != entprop.Velocity) {
471 _velocity = entprop.Velocity;
472 changed = true;
473 }
474 if (_acceleration != entprop.Acceleration) {
475 _acceleration = entprop.Acceleration;
476 changed = true;
477 }
478 if (_rotationalVelocity != entprop.RotationalVelocity) {
479 _rotationalVelocity = entprop.RotationalVelocity;
480 changed = true;
481 }
482 if (changed) {
483 // m_log.DebugFormat("{0}: UpdateProperties: id={1}, c={2}, pos={3}, rot={4}", LogHeader, LocalID, changed, _position, _orientation);
484 // Avatar movement is not done by generating this event. There is code in the heartbeat
485 // loop that updates avatars.
486 // base.RequestPhysicsterseUpdate();
487 }
488 */
489 _position = entprop.Position; 483 _position = entprop.Position;
490 _orientation = entprop.Rotation; 484 _orientation = entprop.Rotation;
491 _velocity = entprop.Velocity; 485 _velocity = entprop.Velocity;
492 _acceleration = entprop.Acceleration; 486 _acceleration = entprop.Acceleration;
493 _rotationalVelocity = entprop.RotationalVelocity; 487 _rotationalVelocity = entprop.RotationalVelocity;
494 // Avatars don't report theirr changes the usual way. Changes are checked for in the heartbeat loop. 488 // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop.
495 // base.RequestPhysicsterseUpdate(); 489 // base.RequestPhysicsterseUpdate();
496 } 490 }
497 491