aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODECharacter.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs57
1 files changed, 28 insertions, 29 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 0f1a897..c838587 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -178,7 +178,7 @@ namespace OpenSim.Region.Physics.OdePlugin
178 parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f); 178 parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f);
179 m_taintPosition = _position; 179 m_taintPosition = _position;
180 180
181 m_log.Warn("[PHYSICS]: Got NaN Position on Character Create"); 181 m_log.WarnFormat("[ODE CHARACTER]: Got NaN Position on Character Create for {0}", avName);
182 } 182 }
183 183
184 _parent_scene = parent_scene; 184 _parent_scene = parent_scene;
@@ -201,7 +201,7 @@ namespace OpenSim.Region.Physics.OdePlugin
201 m_colliderarr[i] = false; 201 m_colliderarr[i] = false;
202 } 202 }
203 CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; 203 CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
204 //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); 204 //m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH.ToString());
205 m_tainted_CAPSULE_LENGTH = CAPSULE_LENGTH; 205 m_tainted_CAPSULE_LENGTH = CAPSULE_LENGTH;
206 206
207 m_isPhysical = false; // current status: no ODE information exists 207 m_isPhysical = false; // current status: no ODE information exists
@@ -266,7 +266,7 @@ namespace OpenSim.Region.Physics.OdePlugin
266 set 266 set
267 { 267 {
268 flying = value; 268 flying = value;
269// m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying); 269// m_log.DebugFormat("[ODE CHARACTER]: Set OdeCharacter Flying to {0}", flying);
270 } 270 }
271 } 271 }
272 272
@@ -437,7 +437,7 @@ namespace OpenSim.Region.Physics.OdePlugin
437 } 437 }
438 else 438 else
439 { 439 {
440 m_log.Warn("[PHYSICS]: Got a NaN Position from Scene on a Character"); 440 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Position from Scene on character {0}", Name);
441 } 441 }
442 } 442 }
443 } 443 }
@@ -464,7 +464,7 @@ namespace OpenSim.Region.Physics.OdePlugin
464 464
465 Vector3 SetSize = value; 465 Vector3 SetSize = value;
466 m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; 466 m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
467// m_log.Info("[SIZE]: " + CAPSULE_LENGTH); 467// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH);
468 468
469 // If we reset velocity here, then an avatar stalls when it crosses a border for the first time 469 // If we reset velocity here, then an avatar stalls when it crosses a border for the first time
470 // (as the height of the new root agent is set). 470 // (as the height of the new root agent is set).
@@ -474,7 +474,7 @@ namespace OpenSim.Region.Physics.OdePlugin
474 } 474 }
475 else 475 else
476 { 476 {
477 m_log.Warn("[PHYSICS]: Got a NaN Size from Scene on a Character"); 477 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size from Scene on {0}", Name);
478 } 478 }
479 } 479 }
480 } 480 }
@@ -533,7 +533,7 @@ namespace OpenSim.Region.Physics.OdePlugin
533 float xTiltComponent = -movementVector.X * m_tiltMagnitudeWhenProjectedOnXYPlane; 533 float xTiltComponent = -movementVector.X * m_tiltMagnitudeWhenProjectedOnXYPlane;
534 float yTiltComponent = -movementVector.Y * m_tiltMagnitudeWhenProjectedOnXYPlane; 534 float yTiltComponent = -movementVector.Y * m_tiltMagnitudeWhenProjectedOnXYPlane;
535 535
536 //m_log.Debug("[PHYSICS] changing avatar tilt"); 536 //m_log.Debug("[ODE CHARACTER]: changing avatar tilt");
537 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, xTiltComponent); 537 d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, xTiltComponent);
538 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, xTiltComponent); // must be same as lowstop, else a different, spurious tilt is introduced 538 d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, xTiltComponent); // must be same as lowstop, else a different, spurious tilt is introduced
539 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, yTiltComponent); 539 d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, yTiltComponent);
@@ -560,17 +560,16 @@ namespace OpenSim.Region.Physics.OdePlugin
560 _parent_scene.waitForSpaceUnlock(_parent_scene.space); 560 _parent_scene.waitForSpaceUnlock(_parent_scene.space);
561 if (CAPSULE_LENGTH <= 0) 561 if (CAPSULE_LENGTH <= 0)
562 { 562 {
563 m_log.Warn("[PHYSICS]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!"); 563 m_log.Warn("[ODE CHARACTER]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
564 CAPSULE_LENGTH = 0.01f; 564 CAPSULE_LENGTH = 0.01f;
565
566 } 565 }
567 566
568 if (CAPSULE_RADIUS <= 0) 567 if (CAPSULE_RADIUS <= 0)
569 { 568 {
570 m_log.Warn("[PHYSICS]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!"); 569 m_log.Warn("[ODE CHARACTER]: The capsule size you specified in opensim.ini is invalid! Setting it to the smallest possible size!");
571 CAPSULE_RADIUS = 0.01f; 570 CAPSULE_RADIUS = 0.01f;
572
573 } 571 }
572
574 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); 573 Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);
575 574
576 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); 575 d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);
@@ -770,7 +769,7 @@ namespace OpenSim.Region.Physics.OdePlugin
770 } 769 }
771 else 770 else
772 { 771 {
773 m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character"); 772 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN velocity from Scene for {0}", Name);
774 } 773 }
775 774
776// m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", m_taintTargetVelocity); 775// m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", m_taintTargetVelocity);
@@ -848,7 +847,7 @@ namespace OpenSim.Region.Physics.OdePlugin
848 } 847 }
849 else 848 else
850 { 849 {
851 m_log.Warn("[PHYSICS]: Got a NaN force applied to a Character"); 850 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN force applied to {0}", Name);
852 } 851 }
853 //m_lastUpdateSent = false; 852 //m_lastUpdateSent = false;
854 } 853 }
@@ -874,11 +873,11 @@ namespace OpenSim.Region.Physics.OdePlugin
874 /// Called from Simulate 873 /// Called from Simulate
875 /// This is the avatar's movement control + PID Controller 874 /// This is the avatar's movement control + PID Controller
876 /// </summary> 875 /// </summary>
877 /// <param name="defects"> 876 /// <remarks>
878 /// If there is something wrong with the character (e.g. its position is non-finite) 877 /// This routine will remove the character from the physics scene if it detects something wrong (non-finite
879 /// then it is added to this list. The ODE structures associated with it are also destroyed. 878 /// position or velocity).
880 /// </param> 879 /// </remarks>
881 internal void Move(List<OdeCharacter> defects) 880 internal void Move()
882 { 881 {
883 // no lock; for now it's only called from within Simulate() 882 // no lock; for now it's only called from within Simulate()
884 883
@@ -899,11 +898,11 @@ namespace OpenSim.Region.Physics.OdePlugin
899 898
900 if (!localPos.IsFinite()) 899 if (!localPos.IsFinite())
901 { 900 {
902 m_log.WarnFormat("[PHYSICS]: Avatar Position of {0} is non-finite!", Name); 901 m_log.WarnFormat(
903 902 "[ODE CHARACTER]: Avatar position of {0} for {1} is non-finite! Removing from physics scene.",
904 defects.Add(this); 903 localPos, Name);
905 // _parent_scene.RemoveCharacter(this);
906 904
905 _parent_scene.RemoveCharacter(this);
907 DestroyOdeStructures(); 906 DestroyOdeStructures();
908 907
909 return; 908 return;
@@ -1038,11 +1037,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1038 } 1037 }
1039 else 1038 else
1040 { 1039 {
1041 m_log.Warn("[PHYSICS]: Got a NaN force vector in Move()"); 1040 m_log.WarnFormat(
1042 m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); 1041 "[ODE CHARACTER]: Got a NaN force vector {0} in Move() for {1}. Removing character from physics scene.",
1043 defects.Add(this); 1042 vec, Name);
1044 // _parent_scene.RemoveCharacter(this);
1045 1043
1044 _parent_scene.RemoveCharacter(this);
1046 DestroyOdeStructures(); 1045 DestroyOdeStructures();
1047 } 1046 }
1048 } 1047 }
@@ -1061,7 +1060,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1061 catch (NullReferenceException) 1060 catch (NullReferenceException)
1062 { 1061 {
1063 bad = true; 1062 bad = true;
1064 _parent_scene.BadCharacter(this); 1063 _parent_scene.RemoveCharacter(this);
1065 DestroyOdeStructures(); 1064 DestroyOdeStructures();
1066 newPos = new d.Vector3(_position.X, _position.Y, _position.Z); 1065 newPos = new d.Vector3(_position.X, _position.Y, _position.Z);
1067 base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem! 1066 base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem!
@@ -1275,7 +1274,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1275 // Create avatar capsule and related ODE data 1274 // Create avatar capsule and related ODE data
1276 if (!(Shell == IntPtr.Zero && Body == IntPtr.Zero && Amotor == IntPtr.Zero)) 1275 if (!(Shell == IntPtr.Zero && Body == IntPtr.Zero && Amotor == IntPtr.Zero))
1277 { 1276 {
1278 m_log.Warn("[PHYSICS]: re-creating the following avatar ODE data, even though it already exists - " 1277 m_log.Warn("[ODE CHARACTER]: re-creating the following avatar ODE data for " + Name + ", even though it already exists - "
1279 + (Shell!=IntPtr.Zero ? "Shell ":"") 1278 + (Shell!=IntPtr.Zero ? "Shell ":"")
1280 + (Body!=IntPtr.Zero ? "Body ":"") 1279 + (Body!=IntPtr.Zero ? "Body ":"")
1281 + (Amotor!=IntPtr.Zero ? "Amotor ":"")); 1280 + (Amotor!=IntPtr.Zero ? "Amotor ":""));
@@ -1320,7 +1319,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1320 } 1319 }
1321 else 1320 else
1322 { 1321 {
1323 m_log.Warn("[ODE CHARACTER]: trying to change capsule size, but the following ODE data is missing - " 1322 m_log.Warn("[ODE CHARACTER]: trying to change capsule size for " + Name + ", but the following ODE data is missing - "
1324 + (Shell==IntPtr.Zero ? "Shell ":"") 1323 + (Shell==IntPtr.Zero ? "Shell ":"")
1325 + (Body==IntPtr.Zero ? "Body ":"") 1324 + (Body==IntPtr.Zero ? "Body ":"")
1326 + (Amotor==IntPtr.Zero ? "Amotor ":"")); 1325 + (Amotor==IntPtr.Zero ? "Amotor ":""));