diff options
author | ubit | 2012-05-12 13:19:57 +0200 |
---|---|---|
committer | ubit | 2012-05-12 13:19:57 +0200 |
commit | 67ee100f2f32b4680310fa19cf4b04cc540d59ad (patch) | |
tree | 3bea63ef41ec6c570329f77c66e5b19f0de3b703 | |
parent | Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff) | |
parent | ubitODE: trial workaround for avatar colisions (diff) | |
download | opensim-SC-67ee100f2f32b4680310fa19cf4b04cc540d59ad.zip opensim-SC-67ee100f2f32b4680310fa19cf4b04cc540d59ad.tar.gz opensim-SC-67ee100f2f32b4680310fa19cf4b04cc540d59ad.tar.bz2 opensim-SC-67ee100f2f32b4680310fa19cf4b04cc540d59ad.tar.xz |
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 55 |
2 files changed, 51 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs index 43b4581..b0711d7 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs | |||
@@ -1006,9 +1006,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1006 | } | 1006 | } |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | if (velLengthSquared > 625.0f) // 25m/s apply breaks | 1009 | if (velLengthSquared > 2500.0f) // 50m/s apply breaks |
1010 | { | 1010 | { |
1011 | breakfactor = 0.31f * m_mass; | 1011 | breakfactor = 0.16f * m_mass; |
1012 | vec.X -= breakfactor * vel.X; | 1012 | vec.X -= breakfactor * vel.X; |
1013 | vec.Y -= breakfactor * vel.Y; | 1013 | vec.Y -= breakfactor * vel.Y; |
1014 | vec.Z -= breakfactor * vel.Z; | 1014 | vec.Z -= breakfactor * vel.Z; |
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 | ||