aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs55
1 files changed, 49 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index e0de6cc..63462b1 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -537,7 +537,7 @@ namespace OpenSim.Region.Physics.OdePlugin
537 // Essentially Steps * m_physicsiterations 537 // Essentially Steps * m_physicsiterations
538 d.WorldSetQuickStepNumIterations(world, m_physicsiterations); 538 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
539 539
540 d.WorldSetContactMaxCorrectingVel(world, 50.0f); 540 d.WorldSetContactMaxCorrectingVel(world, 100.0f);
541 541
542 spacesPerMeter = 1 / metersInSpace; 542 spacesPerMeter = 1 / metersInSpace;
543 spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeter); 543 spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeter);
@@ -754,14 +754,15 @@ namespace OpenSim.Region.Physics.OdePlugin
754 } 754 }
755 755
756 // big messy collision analises 756 // big messy collision analises
757
758 Vector3 normoverride = Vector3.Zero; //damm c#
759
757 float mu = 0; 760 float mu = 0;
758 float bounce = 0; 761 float bounce = 0;
759 float cfm = 0.0001f; 762 float cfm = 0.0001f;
760 float erp = 0.1f;
761 float erpscale = 1.0f; 763 float erpscale = 1.0f;
762 float dscale = 1.0f; 764 float dscale = 1.0f;
763 bool IgnoreNegSides = false; 765 bool IgnoreNegSides = false;
764
765 766
766 ContactData contactdata1 = new ContactData(0, 0, false); 767 ContactData contactdata1 = new ContactData(0, 0, false);
767 ContactData contactdata2 = new ContactData(0, 0, false); 768 ContactData contactdata2 = new ContactData(0, 0, false);
@@ -770,14 +771,30 @@ namespace OpenSim.Region.Physics.OdePlugin
770 bool dop1foot = false; 771 bool dop1foot = false;
771 bool dop2foot = false; 772 bool dop2foot = false;
772 bool ignore = false; 773 bool ignore = false;
774 bool AvanormOverride = false;
773 775
774 switch (p1.PhysicsActorType) 776 switch (p1.PhysicsActorType)
775 { 777 {
776 case (int)ActorTypes.Agent: 778 case (int)ActorTypes.Agent:
777 { 779 {
778 bounce = 0; 780 AvanormOverride = true;
779 mu = 0; 781 Vector3 tmp = p2.Position - p1.Position;
780 cfm = 0.0001f; 782 normoverride = p2.Velocity - p1.Velocity;
783 mu = normoverride.LengthSquared();
784
785 if (mu > 1e-6)
786 {
787 mu = 1.0f / (float)Math.Sqrt(mu);
788 normoverride *= mu;
789 mu = Vector3.Dot(tmp, normoverride);
790 if (mu > 0)
791 normoverride *= -1;
792 }
793 else
794 {
795 tmp.Normalize();
796 normoverride = -tmp;
797 }
781 798
782 switch (p2.PhysicsActorType) 799 switch (p2.PhysicsActorType)
783 { 800 {
@@ -824,6 +841,25 @@ namespace OpenSim.Region.Physics.OdePlugin
824 // p1.getContactData(ref contactdata1); 841 // p1.getContactData(ref contactdata1);
825 // p2.getContactData(ref contactdata2); 842 // p2.getContactData(ref contactdata2);
826 843
844 AvanormOverride = true;
845
846 Vector3 tmp = p2.Position - p1.Position;
847 normoverride = p2.Velocity - p1.Velocity;
848 mu = normoverride.LengthSquared();
849 if (mu > 1e-6)
850 {
851 mu = 1.0f / (float)Math.Sqrt(mu);
852 normoverride *= mu;
853 mu = Vector3.Dot(tmp, normoverride);
854 if (mu > 0)
855 normoverride *= -1;
856 }
857 else
858 {
859 tmp.Normalize();
860 normoverride = -tmp;
861 }
862
827 bounce = 0; 863 bounce = 0;
828 mu = 0; 864 mu = 0;
829 cfm = 0.0001f; 865 cfm = 0.0001f;
@@ -974,6 +1010,13 @@ namespace OpenSim.Region.Physics.OdePlugin
974 if (dop2foot && (p2.Position.Z - curContact.pos.Z) > (p2.Size.Z - avCapRadius) * 0.5f) 1010 if (dop2foot && (p2.Position.Z - curContact.pos.Z) > (p2.Size.Z - avCapRadius) * 0.5f)
975 p2.IsColliding = true; 1011 p2.IsColliding = true;
976 1012
1013 if (AvanormOverride && curContact.depth > 0.3f)
1014 {
1015 curContact.normal.X = normoverride.X;
1016 curContact.normal.Y = normoverride.Y;
1017 curContact.normal.Z = normoverride.Z;
1018 }
1019
977 Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale); 1020 Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale);
978 d.JointAttach(Joint, b1, b2); 1021 d.JointAttach(Joint, b1, b2);
979 1022