aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorMelanie2011-12-18 10:49:45 +0000
committerMelanie2011-12-18 10:49:45 +0000
commit759f1d2dbe0617786068195dfd695e0dfc2cc265 (patch)
tree8e6dcb6ba183abb16b4527376c5fd280693977bb /OpenSim/Region/Physics
parentMake raycast more efficient by checking exclusion flags earlier (diff)
parentProvide user feedback on execution of "backup" region console command (diff)
downloadopensim-SC_OLD-759f1d2dbe0617786068195dfd695e0dfc2cc265.zip
opensim-SC_OLD-759f1d2dbe0617786068195dfd695e0dfc2cc265.tar.gz
opensim-SC_OLD-759f1d2dbe0617786068195dfd695e0dfc2cc265.tar.bz2
opensim-SC_OLD-759f1d2dbe0617786068195dfd695e0dfc2cc265.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs3
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs47
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs27
4 files changed, 52 insertions, 27 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
index 5e2eeeb..1e1d5e3 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs
@@ -44,8 +44,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
44 private bool flying; 44 private bool flying;
45 private bool iscolliding; 45 private bool iscolliding;
46 46
47 public BasicActor() 47 public BasicActor(Vector3 size)
48 { 48 {
49 Size = size;
49 } 50 }
50 51
51 public override int PhysicsActorType 52 public override int PhysicsActorType
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index 1ceed1a..2e14216 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
56 } 56 }
57 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 57 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
58 { 58 {
59 BasicActor act = new BasicActor(); 59 BasicActor act = new BasicActor(size);
60 act.Position = position; 60 act.Position = position;
61 act.Flying = isFlying; 61 act.Flying = isFlying;
62 _actors.Add(act); 62 _actors.Add(act);
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 73c1c02..f2bb4bf 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Physics.OdePlugin
137 internal IntPtr Body = IntPtr.Zero; 137 internal IntPtr Body = IntPtr.Zero;
138 private OdeScene _parent_scene; 138 private OdeScene _parent_scene;
139 internal IntPtr Shell = IntPtr.Zero; 139 internal IntPtr Shell = IntPtr.Zero;
140 internal IntPtr Amotor = IntPtr.Zero; 140 private IntPtr Amotor = IntPtr.Zero;
141 private d.Mass ShellMass; 141 private d.Mass ShellMass;
142 142
143 private int m_eventsubscription = 0; 143 private int m_eventsubscription = 0;
@@ -195,13 +195,10 @@ namespace OpenSim.Region.Physics.OdePlugin
195 // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f, 195 // new d.Matrix3(0.5f, 0.7071068f, 0.5f, -0.7071068f, 0f, 0.7071068f, 0.5f, -0.7071068f,
196 // 0.5f); 196 // 0.5f);
197 197
198 for (int i = 0; i < 11; i++) 198 // We can set taint and actual to be the same here, since the entire character will be set up when the
199 { 199 // m_tainted_isPhysical is processed.
200 m_colliderarr[i] = false; 200 SetTaintedCapsuleLength(size);
201 } 201 CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH;
202 CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
203 //m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH.ToString());
204 m_tainted_CAPSULE_LENGTH = CAPSULE_LENGTH;
205 202
206 m_isPhysical = false; // current status: no ODE information exists 203 m_isPhysical = false; // current status: no ODE information exists
207 m_tainted_isPhysical = true; // new tainted status: need to create ODE information 204 m_tainted_isPhysical = true; // new tainted status: need to create ODE information
@@ -457,24 +454,28 @@ namespace OpenSim.Region.Physics.OdePlugin
457 get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); } 454 get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
458 set 455 set
459 { 456 {
460 if (value.IsFinite()) 457 SetTaintedCapsuleLength(value);
461 {
462 m_pidControllerActive = true;
463
464 Vector3 SetSize = value;
465 m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
466// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH);
467 458
468 // If we reset velocity here, then an avatar stalls when it crosses a border for the first time 459 // If we reset velocity here, then an avatar stalls when it crosses a border for the first time
469 // (as the height of the new root agent is set). 460 // (as the height of the new root agent is set).
470// Velocity = Vector3.Zero; 461// Velocity = Vector3.Zero;
471 462
472 _parent_scene.AddPhysicsActorTaint(this); 463 _parent_scene.AddPhysicsActorTaint(this);
473 } 464 }
474 else 465 }
475 { 466
476 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size from Scene on {0}", Name); 467 private void SetTaintedCapsuleLength(Vector3 size)
477 } 468 {
469 if (size.IsFinite())
470 {
471 m_pidControllerActive = true;
472
473 m_tainted_CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
474// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH);
475 }
476 else
477 {
478 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.Name);
478 } 479 }
479 } 480 }
480 481
@@ -549,8 +550,8 @@ namespace OpenSim.Region.Physics.OdePlugin
549 { 550 {
550 get 551 get
551 { 552 {
552 float AVvolume = (float) (Math.PI*Math.Pow(CAPSULE_RADIUS, 2)*CAPSULE_LENGTH); 553 float AVvolume = (float)(Math.PI * Math.Pow(CAPSULE_RADIUS, 2) * CAPSULE_LENGTH);
553 return m_density*AVvolume; 554 return m_density * AVvolume;
554 } 555 }
555 } 556 }
556 557
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index a6c2eca..f716687 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -1699,7 +1699,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1699 1699
1700 public override void RemoveAvatar(PhysicsActor actor) 1700 public override void RemoveAvatar(PhysicsActor actor)
1701 { 1701 {
1702 //m_log.Debug("[PHYSICS]:ODELOCK"); 1702// m_log.DebugFormat(
1703// "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}",
1704// actor.Name, actor.LocalID, Name);
1705
1703 ((OdeCharacter) actor).Destroy(); 1706 ((OdeCharacter) actor).Destroy();
1704 } 1707 }
1705 1708
@@ -1709,6 +1712,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1709 { 1712 {
1710 _characters.Add(chr); 1713 _characters.Add(chr);
1711 1714
1715// m_log.DebugFormat(
1716// "[ODE SCENE]: Adding physics character {0} {1} to physics scene {2}. Count now {3}",
1717// chr.Name, chr.LocalID, Name, _characters.Count);
1718
1712 if (chr.bad) 1719 if (chr.bad)
1713 m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to characters list", chr.m_uuid); 1720 m_log.ErrorFormat("[ODE SCENE]: Added BAD actor {0} to characters list", chr.m_uuid);
1714 } 1721 }
@@ -1723,11 +1730,19 @@ namespace OpenSim.Region.Physics.OdePlugin
1723 internal void RemoveCharacter(OdeCharacter chr) 1730 internal void RemoveCharacter(OdeCharacter chr)
1724 { 1731 {
1725 if (_characters.Contains(chr)) 1732 if (_characters.Contains(chr))
1733 {
1726 _characters.Remove(chr); 1734 _characters.Remove(chr);
1735
1736// m_log.DebugFormat(
1737// "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2}. Count now {3}",
1738// chr.Name, chr.LocalID, Name, _characters.Count);
1739 }
1727 else 1740 else
1741 {
1728 m_log.ErrorFormat( 1742 m_log.ErrorFormat(
1729 "[ODE SCENE]: Tried to remove character {0} {1} but they are not in the list!", 1743 "[ODE SCENE]: Tried to remove character {0} {1} but they are not in the list!",
1730 chr.Name, chr.LocalID); 1744 chr.Name, chr.LocalID);
1745 }
1731 } 1746 }
1732 1747
1733 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, 1748 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
@@ -1765,7 +1780,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1765 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, 1780 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1766 Vector3 size, Quaternion rotation, bool isPhysical, uint localid) 1781 Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
1767 { 1782 {
1768// m_log.DebugFormat("[ODE SCENE]: Adding physics actor to {0} {1}", primName, localid); 1783// m_log.DebugFormat("[ODE SCENE]: Adding physics prim {0} {1} to physics scene {2}", primName, localid, Name);
1769 1784
1770 return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid); 1785 return AddPrim(primName, position, size, rotation, pbs, isPhysical, localid);
1771 } 1786 }
@@ -2755,6 +2770,10 @@ namespace OpenSim.Region.Physics.OdePlugin
2755 { 2770 {
2756 foreach (OdeCharacter actor in defects) 2771 foreach (OdeCharacter actor in defects)
2757 { 2772 {
2773 m_log.ErrorFormat(
2774 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving",
2775 actor.Name, actor.LocalID, Name);
2776
2758 RemoveCharacter(actor); 2777 RemoveCharacter(actor);
2759 actor.DestroyOdeStructures(); 2778 actor.DestroyOdeStructures();
2760 } 2779 }
@@ -2825,6 +2844,10 @@ namespace OpenSim.Region.Physics.OdePlugin
2825 { 2844 {
2826 foreach (OdeCharacter actor in defects) 2845 foreach (OdeCharacter actor in defects)
2827 { 2846 {
2847 m_log.ErrorFormat(
2848 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity",
2849 actor.Name, actor.LocalID, Name);
2850
2828 RemoveCharacter(actor); 2851 RemoveCharacter(actor);
2829 actor.DestroyOdeStructures(); 2852 actor.DestroyOdeStructures();
2830 } 2853 }